Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes HttpSessions in non-servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSessions in non-servlets" Watch "HttpSessions in non-servlets" New topic
Author

HttpSessions in non-servlets

Shrikanth Goloposwami
Greenhorn

Joined: Feb 09, 2001
Posts: 7
Hi,
I have a HttpServlet controller that intercepts requests and maps those requests to Action objects. These Action objects are not HttpServlets; however, there is a need to retrieve the request sent by the HttpServlet controller, create a session and pass the request back to the controller for forwarding. The sessions are being created successfully in the Action objects, it just can't pass the session along to the HttpServlet controller. Is is possible to pass HttpSession objects from a non-servlet to a servlet via the request object?
Any thoughts?
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
You can have the javax.servlet.http.HttpServletRequest request as argument of your action methods.(or in the constructor)
Then when you call the action method, you still have a request object you can work with and you can send back to a servlet later.


/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
 
jQuery in Action, 2nd edition
 
subject: HttpSessions in non-servlets
 
Similar Threads
where to write session related code
Complex types in a struts form
Best Practise and why
Accessing a session scoped variable anywhere outside the session scoped context
Set Managed Bean property (value) without user interaction