Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Send Session Object to Servlet through Applet

 
Sameer sam
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Sameer sam
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic