I am having difficulty maintaining the state of an object between two pages, say a.jsp and b.jsp. I only want the bean in scope for these two pages. Page a.jsp presents a form and instantiates MyBean myBean using request scope. During instantiation of myBean, some properties are set. When the user hits submit, b.jsp is called. b.jsp also uses myBean in request scope, and sets any properties sent via the form. Now my question is, why isn't the state of the myBean in b.jsp the same as the state of myBean in a.jsp. I have a property that is set in a.jsp (and not corresponding to a form field), that is no longer set when b.jsp uses myBean. I know that if I had used session scope, this wouldn't be a problem, but because of the application, session scope shouldn't be used with this bean. I also know that I could just pass the properties in hidden form fields, but I was hoping there was a more elegant way to do this. Again, I thought that 'request' scope might be the answer, but it doesn't seem to be working. I've RTFM but I must be missing something with regards to request scope. Anyone have any ideas? TIA, J
What you want is session scope, not request scope. Request scope is used for objects that you want to accompany a forwarded request (HttpServletRequest object). Since the life of a request object is over after the response has been sent, naturally the next request can't see the same bean.