Hi,
I am trying to pass values from a
JSP form to an action
servlet using a
Java Bean.
JSP Code:
<form action="LoginServlet">
<jsp:useBean id="user" class=" model.User"
scope="session">
<jsp:setProperty name="user" property="*" />
</jsp:useBean>
<tr>
<td>Username:</td>
<td><input type="text"name="userId"/>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password"/></td>
</tr>
( I have also tried setting the scope to 'request' )
Then in the servlet, I try to pick it up using: -
Servlet code:
HttpSession session = request.getSession(true);
userBean = (User)session.getAttribute("user");
But the userBean always comes up as a null, I never get the Java bean making it through the request or session.
Please, point out what is wrong with the above code.
Thanks.