studentactionform.java

来自「这个是j2eejava web 编程精要十五讲的全部源码。对学习java web」· Java 代码 · 共 56 行

JAVA
56
字号
package studentInfo;import org.apache.struts.action.*;import javax.servlet.http.*;public class StudentActionForm extends ActionForm {  private String age;  private String name;  private String sex;  private String studNo;  public String getAge() {    return age;  }  public void setAge(String age) {    this.age = age;  }  public String getName() {    return name;  }  public void setName(String name) {    this.name = name;  }  public String getSex() {    return sex;  }  public void setSex(String sex) {    this.sex = sex;  }  public String getStudNo() {    return studNo;  }  public void setStudNo(String studNo) {    this.studNo = studNo;  }  public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {    ActionErrors errors = new ActionErrors();    if((studNo==null)||(studNo.length()<3)) {    errors.add("studNo",new ActionMessage("error.studNo.required",studNo));    }    if((name==null)||(name.length()<3)) {    errors.add("name",new ActionMessage("error.name.required",name));    }    if((age==null)||(age.length()>3)) {    errors.add("age",new ActionMessage("error.age.required",age));    }    return errors;  }  public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?