UserForm.java
上传用户:jishiqi_cj
上传日期:2022-08-08
资源大小:24765k
文件大小:1k
- package test;
- import org.apache.struts.action.ActionForm;
- import org.apache.struts.action.ActionMapping;
- import org.apache.struts.action.ActionError;
- import org.apache.struts.action.ActionErrors;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- public class UserForm extends ActionForm{
- private String name = null; //用户名
- private String psw = null; //密码
- public UserForm(){}
- public void setName(String name) {
- this.name = name;
- }
- public String getName() {
- return name;
- }
- public void setPsw(String psw) {
- this.psw = psw;
- }
- public String getPsw() {
- return psw;
- }
-
- public void reset(ActionMapping mapping,
- HttpServletRequest request) {
- this.name = null;
- this.psw = null;
- }
- public ActionErrors validate(ActionMapping mapping,
- HttpServletRequest request) {
- ActionErrors errors = new ActionErrors();
- if ((name == null) || (name.equals(""))){
- errors.add("name",
- new ActionError("error.regist.name.required"));
- }
- if((psw == null) || (psw.equals(""))){
- errors.add("psw",
- new ActionError("error.regist.psw.required"));
- }
- return errors;
- }
- }