📄 userform.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package cn.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.validator.ValidatorForm;
/**
* MyEclipse Struts
* Creation date: 01-05-2008
*
* XDoclet definition:
* @struts.form name="userForm"
*/
public class UserForm extends ValidatorForm {
/*
* Generated fields
*/
/** password property */
private String password;
/** langsin property */
private String langsin;
/** password2 property */
private String password2;
/** username property */
private String username;
/** email property */
private String email;
/*
* 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();
if (username.trim().equals("")){
errors.add("username",new ActionError("errors.username_is_required"));
}
if (password.trim().equals("")){
errors.add("password",new ActionError("errors.password_is_required"));
}
if (!password.trim().equals(password2)){
errors.add("password2",new ActionError("errors.password_is_not_same"));
}
if (email.indexOf("@")==-1 || email.indexOf(".")==-1){
errors.add("email",new ActionError("errors.email_format_wrong"));
}
if (!langsin.trim().equals("langsin")){
errors.add("langsin",new ActionError("errors.langsin_content_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;
}
/**
* Returns the langsin.
* @return String
*/
public String getLangsin() {
return langsin;
}
/**
* Set the langsin.
* @param langsin The langsin to set
*/
public void setLangsin(String langsin) {
this.langsin = langsin;
}
/**
* Returns the password2.
* @return String
*/
public String getPassword2() {
return password2;
}
/**
* Set the password2.
* @param password2 The password2 to set
*/
public void setPassword2(String password2) {
this.password2 = password2;
}
/**
* 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 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;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -