Hi All, In a jsp file i use <jsp:useBean id="mybean" scope="request" class="MyBeanClass"/> <jsp:setProperty name="mybean" property="*"/> <jsp:forward page="/servlet/myServlet" /> In my servlet file myServlet I want to use the bean.. I don't know how to use the mybean in servlet to get the value set in the jspfile.. Any hints would be a gr8 help.. thanx Dhaval Patel. SCJP2
Buzz Andersen
Ranch Hand
Joined: Aug 28, 2001
Posts: 54
posted
0
Since you are forwarding to the servlet, and your bean is in request scope, you can simply get the bean off the request. Like this: // Get the bean off the request. MyBeanClass theBean = (MyBeanClass) request.getAttribute("mybean"); Then you can simply deal with the bean as you would normally (i.e. theBean.getX(), theBean.getY()).
Originally posted by Dhaval Patel: Hi All, In a jsp file i use <jsp:useBean id="mybean" scope="request" class="MyBeanClass"/> <jsp:setProperty name="mybean" property="*"/> <jsp:forward page="/servlet/myServlet" /> In my servlet file myServlet I want to use the bean..