Problem with passing Usebean with scope=request from JSP to servlet
843835May 1 2002 — edited May 1 2002The request Usebean from JSP to servlet gets lost when form is submitted directly to the servlet, but this works fine if it goes to another JSP page and then forwarded to servlet.
For example if JSP1 form is submitted to a servlet then "servicesAvailHandler" attribute cannot be accessed under Request object in servlet code. It comes out as null
But if JSP1 form is forwarded to JSP2, and JSP2 instantiates the same UseBean as in JSP1, then JSP2 gets access to JSP1 usebean, in this case "servicesAvailHandler". Then on the servlet side one can access "servicesAvailHandler" in the request object. Any clarification will help
Thanks
Here the pseudo code
JSP1:
<jsp:useBean id="servicesAvailHandler" class="com.springtide.stWbssServer2.StAvailableServices" scope="request">
<jsp:setProperty name="servicesAvailHandler" property="*"/>
</jsp:useBean>
<form enctype="application/x-www-form-urlencoded" method="POST" action="/StWbssServlet">
(In this case inside StWbssServlet doPost - request.getAttribute("servicesAvailHandler") == null;)
Or
<form enctype="application/x-www-form-urlencoded" method="POST" action="/JSP2">
(In this case inside StWbssServlet doPost - request.getAttribute("servicesAvailHandler") != null;)
JSP2:
<jsp:useBean id="servicesAvailHandler" class="com.springtide.stWbssServer2.StAvailableServices" scope="request">
<jsp:setProperty name="servicesAvailHandler" property="*"/>
</jsp:useBean>
<jsp:forward page="/StWbssServlet"/>
StWbssServlet:
If directly from JSP1->Servlet
In this case inside StWbssServlet doPost - request.getAttribute("servicesAvailHandler") == null;)
If directly from JSP1->JSP2->Servlet
In this case inside StWbssServlet doPost - request.getAttribute("servicesAvailHandler") != null;)
Any ideas why forwading works, while submitting as an action from JSP form to servlet doesn't.
Thanks
-Vin