File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes can I maintain the session when call a servlet from an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "can I maintain the session when call a servlet from an applet" Watch "can I maintain the session when call a servlet from an applet" New topic
Author

can I maintain the session when call a servlet from an applet

Linda Xu
Ranch Hand

Joined: Feb 14, 2000
Posts: 51
Hi, ALL
In my project, I have a JSP page and a servlet. If I direct trigger the applet from the JSP page using
<FORM Action="/servlet/myServlet" METHOD ="post">
I can maintain the session that means in my servlet I can use:
HttpSession session = req.getSession();
session.getValue("itemName");
...
to retrieve the item from session.
But now, I have an applet on my JSP file, and I want to trigger myServlet from the applet using an HTTP call, can I still maintain the session? I mean can myServlet still use the same way to retrive stuff which the JSP put into the session?
Thank you very much for any comments!
parind poi
Greenhorn

Joined: Jun 19, 2001
Posts: 9
Absolutely yes.
Whether you invoke the servlet through a browser or an applet, since the protocol is HTTP, the web server services them all in the same manner.
Hope this helps.
Parind
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can I maintain the session when call a servlet from an applet
 
It's not a secret anymore!