/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.jlins.struts.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.validator.ValidatorForm;
/**
* MyEclipse Struts
* Creation date: 03-08-2008
*
* XDoclet definition:
* @struts.form name="usersForm"
*/
public class UsersForm extends ValidatorForm {
/*
* Generated fields
*/
/** password property */
private String password;
private String password1;
/** userName property */
private String userName;
/** address property */
private String address;
/** email property */
private String email;
/** addtime property */
private String addtime;
/** tel property */
private String tel;
/*
* Generated Methods
*/
/**
* Method validate
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors errors =new ActionErrors();
String action =request.getParameter("action");
if(action.equalsIgnoreCase("save")){
if(userName.trim().equals("")){
errors.add("userName",new ActionError("errors.userName_is_required"));
}
else if(userName.trim().length()>25){
errors.add("userName", new ActionError("errors.userName_is_duoyu_10"));
}
else if(userName.trim().length()<3){
errors.add("userName", new ActionError("errors.userName_shaoyu_5"));
}
if(password.trim().equals("")){
errors.add("password",new ActionError("errors.password_is_required"));
}
else if(password1!=null)
if(!password1.equals(password)){
errors.add("password1",new ActionError("errors.password_is_not_same"));
}
if(address.trim().equals("")){
errors.add("address",new ActionError("errors.address_is_not_null"));
}
if(email.indexOf("@")==-1 || email.indexOf(".")==-1)
{
errors.add("email",new ActionError("errors.email_type_wrong"));
}
}
return errors;
}
/**
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}
/**
* Returns the password.
* @return String
*/
public String getPassword() {
return password;
}
/**
* Set the password.
* @param password The password to set
*/
public void setPassword(String password) {
this.password = password;
}
public String getPassword1() {
return password1;
}
/**
* Set the password.
* @param password The password to set
*/
public void setPassword1(String password) {
this.password1 = password;
}
/**
* Returns the userName.
* @return String
*/
public String getUserName() {
return userName;
}
/**
* Set the userName.
* @param userName The userName to set
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* Returns the address.
* @return String
*/
public String getAddress() {
return address;
}
/**
* Set the address.
* @param address The address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* Returns the email.
* @return String
*/
public String getEmail() {
return email;
}
/**
* Set the email.
* @param email The email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* Returns the addtime.
* @return String
*/
public String getAddtime() {
return addtime;
}
/**
* Set the addtime.
* @param addtime The addtime to set
*/
public void setAddtime(String addtime) {
this.addtime = addtime;
}
/**
* Returns the tel.
* @return Integer
*/
public String getTel() {
return tel;
}
/**
* Set the tel.
* @param tel The tel to set
*/
public void setTel(String tel) {
this.tel = tel;
}
}