Hi,
The files you have mentioned will hold the following contents:
1) Validator---> The validations you want to keep for your form fields.
2) Command---> your bean object
3) Controller---> Simpleformcontroller
4) jsp---> the
jsp file with spring:bind tags associated with the corresponding fields.
I am giving the sample code as follows:
Validator:
public class LoginValidator implements Validator {
private static final int MINIMUM_PASSWORD_LENGTH = 4;
public boolean supports(Class beanName) {
return beanName.equals(Login.class);
}
public void validate(Object target, Errors errors) {
Login login = (Login) target;
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name","field.required", "usrname required");
jsp:
<spring:bind path="login.name">
<input type="text" name="name"
class="LoginTextBox" value="<c

ut value="${status.value}"/>" />
<c:if test="${status.error}">
<c:set var="errormsg" value="${status.errorMessage}"/>
</c:if>
</spring:bind>
Controller:
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object obj, BindException exp)
throws Exception {
if (request.getSession().getAttribute("userName") == null) {
Login login = (Login) obj;
boolean isExist = loginservice.isValid(login.getName(), login
.getPassword());
if (isExist) {
request.getSession().setAttribute("userName", login.getName());
return new ModelAndView(getSuccessView());
} else {
return new ModelAndView(getFailedView());
}
servlet-action.xml:
<bean id="loginController" class="com.lbadmin.web.LoginController">
<property name="formView"><value>login</value></property>
<property name="successView"><value>redirect:/adminHome.do</value></property>
<property name="failedView"><value>fail</value></property>
<property name="commandClass"><value>com.lbadmin.model.Login</value></property>
<property name="commandName"><value>login</value></property>
<property name="loginservice"><ref bean="loginService"/></property>
<property name="validator"><ref bean="loginValidator"/></property>
</bean>
hope this helps.....
Andy