posted 12 years ago
I am working on change password screen. And I am using from validation via validate method into changePasswordBean
Please refer code below of changePassword.jsp page
<struts_html:html>
<body>
<table cellpadding="0" cellspacing="0" border="0" class="nav-table"
width="350">
<tr>
<td class="content">
<h1 class="h1">
<struts_bean:message key="login.link.changePassword" />
</h1></td>
</tr>
</table>
<struts_html:form action="saveChangedPassword.do"
name="changePasswordForm" type="com.otto.lisa.web.ChangePasswordForm"
method="POST" scope="request">
<table cellpadding="0" cellspacing="0" width="350">
<tr>
<td nowrap="nowrap"
style="text-align: right"><struts_bean:message
key="lisa.changepassword.label.username" /></td>
<td><struts_html:text value=""
name="changePasswordForm" tabindex="4" maxlength="15"
property="username" style="error-field"></struts_html:text>
</td>
<td><img width="20" alt="" height="20"
src="gfx/QuestionmarkButton-16x16.png" border="0"
style="cursor: help" title="Username is required." /></td>
</tr>
<tr>
<td nowrap="nowrap"
style="text-align: right"><struts_bean:message
key="lisa.changepassword.label.oldPassword" />
</td>
<td><struts_html:password value=""
name="changePasswordForm" tabindex="4" maxlength="15"
property="oldPassword">
</struts_html:password>
</td>
<td><img width="20" alt="" height="20"
src="gfx/QuestionmarkButton-16x16.png" border="0"
style="cursor: help;" title="Old Password is required." /></td>
</tr>
<tr>
<td nowrap="nowrap"
style="text-align: right"><struts_bean:message
key="lisa.changepassword.label.newPassword" />
</td>
<td><struts_html:password value=""
name="changePasswordForm" tabindex="4" maxlength="15"
property="newPassword"></struts_html:password></td>
<td><img width="20" alt="" height="20"
style="cursor: help" src="gfx/QuestionmarkButton-16x16.png"
border="0"
title="Password should be secure: minimum 8 characters, at least 1 uppercase letter, at least 1 lowercase letter, at least 1 number and at least 1 special character." />
</td>
</tr>
<tr>
<td nowrap="nowrap" style="text-align: right"><struts_bean:message key="lisa.changepassword.label.confirmPassword" />
</td>
<td><struts_html:password value=""
name="changePasswordForm" tabindex="4" maxlength="15"
property="confirmPassword"></struts_html:password>
</td>
<td><img width="20" alt="" height="20"
src="gfx/QuestionmarkButton-16x16.png" border="0"
style="cursor: help"
title="New password and confirm password should be same." /></td>
</tr>
<tr>
<td><struts_html:submit
property="submitForm"
style="width: 60px; text-align: center; height:25px">
<struts_bean:message key="lisa.changepassword.button.submit" />
</struts_html:submit></td>
<td><struts_html:reset property="resetForm" style="width : 60px; text-align: center; height:25px">
<struts_bean:message key="lisa.changepassword.button.reset" />
</struts_html:reset> <struts_html:reset property="cancelForm"
onclick="window.close();"
style="width : 60px; text-align: center; height:25px">
<struts_bean:message key="lisa.changepassword.button.cancel" />
</struts_html:reset></td>
</tr>
<tr>
<td colspan="3" class="error" align="left"></br> <struts_html:errors
property="username" property="oldPassword" property="newPassword"
property="confirmPassword" /> <struts_html:errors
property="securepassword" /> <struts_html:errors
property="matchpassword" /></td>
</tr> </table>
</struts_html:form>
</body>
</struts_html:html>
I am trying to change field color on error occur to a particular field. But i m not able to do it.I try to use errorStyleClass and errorStyle as well bt it giving me an error as This attribute is not recognized.