• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to Send Session Object to Servlet through Applet

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic