• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object bount to Request

 
Rohit Prasad
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34073
336
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic