Hi
In the Form class extend your class from ValidatorAction rather than ActionForm. You must have Validation.xml and validator-rules.xml in your WEB-INF.
Please find a small piece of code attached.
*****************
Form class
******************
public class LoginForm extends ValidatorForm
{
private
String userid =null;
private String password =null;
public void setUserid( String userid)
{
this.userid=userid;
}
public void setPassword( String password)
{
this.password=password;
}
public String getUserid()
{
return userid;
}
public String getPassword()
{
return password;
}
}
***************************
Validation.xml
**************************
<form name="loginForm">
<field property="userid" depends="required">
<arg0 key="loginForm.userName" />
</field>
<field property="password" depends="required">
<arg0 key="loginForm.password" />
</field>
</form>
***************************
struts-config.xml
**************************
<form-beans>
<form-bean name="loginForm"
type="com.abc.xyz.LoginForm" />
</form-beans>
********************
index.jsp
*******************
<tr>User ID:<td width="62%"><html:text property="userid" /></td>
</tr>
<tr>Password:<td><html
assword property="password" /></td>
</tr>
Hope that works for you.
Regards,
Roshani.