Can anybody please help ? I am using WebSphere 4.0 Application server.
I am using the validate() method for client side validation. I am getting redirected to the input Page after validation errors. But the Error Messages which are coded in ApplicationResoureces.properties not shown in the page
JSP PAGE
<%@ page language= "java" session="true" %>
<%@ taglib uri="/WEB-INF/lib/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/lib/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/lib/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/lib/struts-validator.tld" prefix="validator" %>
<html>
<head>
<title></title>
</head>
<body bgcolor="#E2E2E2">
<html:errors/>
<font face="Trebuchet MS" size=1>
<html:form action="/change_password">
<br><br><h4><b>
CHANGE AUTHENICATION PASSWORD</b></h4><br><br>
<html:hidden property="userId" value='<%=(
String)session.getAttribute("userId")%>'/>
<table border="0" width="50%" height="127" cellspacing="1">
<tr>
<td width="50%" height="26" align="right">User</td>
<td width="50%" height="26" align="left">
<input type="text" name="userName" size="20" value='<%=(String)session.getAttribute("userName")%>' style="background-color: #C0C0C0" readonly="true">
</td>
</tr>
<tr>
<td width="50%" height="26" align="right">Old password</td>
<td width="50%" height="26" align="left">
<html

assword property="oldpwd" size="12" maxlength="8"/>
</td>
</tr>
<tr>
<td width="50%" height="26" align="right">New password</td>
<td width="50%" height="26" align="left">
<html

assword property="newpwd" size='12' maxlength='8'/>
</td>
</tr>
<tr>
<td width="50%" height="26" align="right">Re-type new password</td>
<td width="508%" height="26" align="left">
<html

assword property="rnewpwd" size="12" maxlength="8"/>
</td>
</tr>
<tr>
<td colspan="2" height="26"align="center">
</td>
</tr>
<tr>
<td colspan="2" height="26" align="center">
<html:submit property = "change" value="Change Password"/>
<html:reset value="Reset"/>
</td>
</table>
</font>
</html:form>
</body>
</html>
Validate method
public ActionErrors validate(ActionMapping amapping, HttpServletRequest request)
{
ActionErrors errors=new ActionErrors();
if ((oldpwd==null) || (oldpwd.length() != 8))
errors.add("oldpwd", new ActionError("error.changepwd.oldpwd"));
if ((newpwd==null) || (newpwd.length() != 8))
errors.add("newpwd", new ActionError("error.changepwd.newpwd"));
if ((rnewpwd==null) || (rnewpwd.length() != 8))
errors.add("rnewpwd", new ActionError("error.changepwd.rnewpwd"));
if (!newpwd.equals(rnewpwd))
errors.add("notmatch", new ActionError("error.changepwd.notmatch"));
return errors;
}
ApplicationResources.properties
errors.header=<h3>Errors :</h3><UL>
errors.footer=</UL><hr>
error.changepwd.oldpwd=<li>Old password length is invalid</li>
error.changepwd.newpwd=<li>New password length is invalid</li>
error.changepwd.rnewpwd=<li>Retyped new password length is invalid</li>
error.changepwd.notmatch=<li>New password and Re-typed new password do not match</li>
[ July 02, 2003: Message edited by: Manu Ramakrishnan ]