?? userform.java
字號:
package classmate;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMessage;
public class UserForm extends ActionForm{
/**
*
*/
private static final long serialVersionUID = -5155284752792182082L;
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(ActionErrors.GLOBAL_MESSAGE,
new ActionMessage("error.name.required"));
}
if((psw == null) || (psw.equals(""))){
errors.add(ActionErrors.GLOBAL_MESSAGE,new ActionMessage("error.psw.required"));
}
return errors;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -