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?
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 ]
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.
Joined: Mar 22, 2005
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.