📄 userform.java
字号:
/*
* @(#)UserForm.java Apr 3, 2009
* Copyright 2009 qrsx organization, Inc. All rights reserved
*/
package com.qrsx.asset.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
*
* Author : 王希涛<br>
* Company : qrsx software<br>
* Version : 1.0<br>
* Date : Apr 3, 2009<br>
*/
public class UserForm extends ActionForm{
private String id; //主键
private String name; //用户名称
private String loginName; //用户名称
private String password; //密码
private String sex; //性别
private String age; //年龄
private String address; //住址
private String postcard; //邮编
private String telephone; //电话
/*
* (non-Javadoc)
* @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
*/
public ActionErrors validate(
ActionMapping mapping, HttpServletRequest request ){
ActionErrors errors = new ActionErrors();
//loginName必须填写
if( loginName==null || loginName.trim().length()==0 ){
ActionMessage message = new ActionMessage("error.loginName.required");
errors.add("loginName",message);
}
//password必须填写
if( password==null || password.trim().length()==0 ){
ActionMessage message = new ActionMessage("error.password.required");
errors.add("password",message);
}
//Age必须为整数
if( age!=null && age.trim().length()>0 ){
try{
Integer.valueOf(age);
}catch(Exception e){
ActionMessage message = new ActionMessage("error.age.integer");
errors.add("age",message);
}
}
return errors;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the loginName
*/
public String getLoginName() {
return loginName;
}
/**
* @param loginName the loginName to set
*/
public void setLoginName(String loginName) {
this.loginName = loginName;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the sex
*/
public String getSex() {
return sex;
}
/**
* @param sex the sex to set
*/
public void setSex(String sex) {
this.sex = sex;
}
/**
* @return the age
*/
public String getAge() {
return age;
}
/**
* @param age the age to set
*/
public void setAge(String age) {
this.age = age;
}
/**
* @return the address
*/
public String getAddress() {
return address;
}
/**
* @param address the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return the postcard
*/
public String getPostcard() {
return postcard;
}
/**
* @param postcard the postcard to set
*/
public void setPostcard(String postcard) {
this.postcard = postcard;
}
/**
* @return the telephone
*/
public String getTelephone() {
return telephone;
}
/**
* @param telephone the telephone to set
*/
public void setTelephone(String telephone) {
this.telephone = telephone;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -