package com.arkzoyd.struts.sample4.beans; import org.apache.struts.action.*; import javax.servlet.http.HttpServletRequest; public class logonForm extends ActionForm { String username; String password; public String getUsername() { return username; } public void setUsername(String newUsername) { username = newUsername; } public String getPassword() { return password; } public void setPassword(String newPassword) { password = newPassword; } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (this.getUsername().length()<1) { errors.add("Username", new ActionError("error.index.username")); } if (this.getPassword().length() < 3) { errors.add("Password", new ActionError("error.index.password")); } return errors; } public void reset(ActionMapping mapping, HttpServletRequest request) { this.password = null; this.username = null; } }