dcsimg
How to pass a bean as HttpServletRequest from jsp?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, April 17, 2003 01:33 AM


I Have an object from servlet. and I put in request.
request.setAttribute("object", object);


then in jsp I create bean to copy that object.



after the jsp is submitted, why i couldn't get that object from request in servlet.
Object object = request.getObject("id");
the object is null. why?

Re: How to pass a bean as HttpServletRequest from jsp?

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, April 17, 2003 06:37 AM

Are they all part of the same request? Otherwise that is what session scope is for.



Each time a client submits something to the server, it starts a whole new request. So, if you set something in request scope from the jsp, how are you invoking the servlet? the only way to keep it in the same request, as far as I know, would be to do a jsp:include. If you return a response from the jsp to a client, blam that previous request is gone, so if the servlet gets invoked from the client's new request, you'd have to use session scope, to communicate from the previous jsp to the current servlet.

About | Sitemap | Contact