I have a JSP page with 2 textboxes–one for username and another for password. I’m able to get the values entered in both the fields, but I want to retain the username if the password is incorrect. I need to do it with Java using Spring.
My JSP looks like this:
<tr>
<td align="right">
<b>User ID:</b>
</td>
<td align="left">
<input type="text" id="uname" name="uname" value="<% if(uname!=null){out.println(uname);}%>" size="15" /><br/>
<font color="red"><form:errors path="uname" cssClass="validationError"/></font>
</td>
</tr>
<tr align="center">
<td align="right">
<b>Password:</b>
</td>
<td align="left">
<input type=password id="pwd" name="pwd" value="" size="15" /><br/>
<font color="red"><form:errors path="pwd" cssClass="validationError"/></font>
</td>
</tr>
<tr align="center">
<input type="submit" id="sub" name="sub" value="Submit" size="15" />
<td align="left">
<input type=reset id="clr" name="clr"value="Reset"onclick="doClear();"/>
</td>
</tr>
Have you tried:
or