File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes How to Send Session Object to Servlet through Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How to Send Session Object to Servlet through Applet" Watch "How to Send Session Object to Servlet through Applet" New topic
Author

How to Send Session Object to Servlet through Applet

Sameer sam
Greenhorn

Joined: Oct 15, 2005
Posts: 7
Hi,
I have a JSP page with an applet in it. The applet communicates to a Servlet. The session object that is present in my JSP page is not accessable in my servlet.
How can I get the session object from my JSP page to the Servlet through an Applet?

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Are you talking about an HttpSession object? That should be available to both the JSP and the servlet if both are part of the same web application.
If it is some other object, please elaborate further about its type and use, and we may be able to give you some hints.
[ October 22, 2005: Message edited by: Ulf Dittmer ]

Ping & DNS - updated with new look and Ping home screen widget
Sameer sam
Greenhorn

Joined: Oct 15, 2005
Posts: 7
hi,

Yes it is the Http Session....but when I use to get a URLConnection from Applet to servlet and send some inofmration to Servlet through Applet my web server create another session.
Please keep in mind that it happends while doing an Applet to Servlet communication through URL and URLConnection.

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
So the applet needs to either set a session cookie, or append the jsessionid (or whatever it's called in your server) to the URL it accesses (depending on whether cookies or URL rewriting is used).
HttpSession makes its ID available via the getId() method. The easiest way to get it to the applet is probably to put it as parameter to the <applet> tag.
I don't know that a web app can find out whether it's using cookies or URl rewriting (which the applet would need to know, although I guess it can do both), but maybe that's not a problem for you because you only use one or the other.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Send Session Object to Servlet through Applet
 
Similar Threads
showDocument doesn't work on IE
Can anyone help me with my JSP/servlet problem?
Applet to Servlet session problem
passing objects from jsp to applet
Communication session , servlet applet and back from applet servlet and session