File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Object bount to Request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Object bount to Request " Watch "Object bount to Request " New topic
Author

Object bount to Request

Rohit Prasad
Greenhorn

Joined: Sep 05, 2006
Posts: 12
Hi,

If I bound any object to request object in Action Servlet, it will be available to the forwarded JSP page but once I move from that JSP page to another Action Servlet I can't get that object from request scope.

Could someone please tell me why this happens and how to get the object from Request in another Action Servlet when Object was bound in previous Action Servlet?

I can use session object but problem is that I have to make sure the the objects are unbind from session when there is no use for them. Some one previously talked about having Session Manager that will monitor the session and unbind the object from the session when user is in use case when object is not needed. Is anyone using this kind of mechanism?

Thanks

Rohit
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29275
    
140

Originally posted by Rohit Prasad:
Could someone please tell me why this happens and how to get the object from Request in another Action Servlet when Object was bound in previous Action Servlet?

The request scope is only available for one request (server roundtrip.) Once the JSP is painted, the request ends and the attributes are no longer available. By the time another action servlet gets a request (or the same action servlet later), that request is gone. In order to get the object, you do need to store it in session scope.


I can use session object but problem is that I have to make sure the the objects are unbind from session when there is no use for them. Some one previously talked about having Session Manager that will monitor the session and unbind the object from the session when user is in use case when object is not needed. Is anyone using this kind of mechanism?

I haven't needed to use the mechanism you describe, but it seems logical.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object bount to Request
 
Similar Threads
HttpSessionBindingListener question
Question on HttpSession and Action class
HFSJ Session Management question
JSF Mental Block
Get attribute from the HttpSession!