LogonForm.java~2~
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package firststrut;
- import org.apache.struts.action.*;
- import javax.servlet.http.*;
- public class LogonForm extends ActionForm {
- private String password;
- private String username;
- public void setPassword(String password) {
- this.password = password;
- }
- public String getPassword() {
- return password;
- }
- public void setUsername(String username) {
- this.username = username;
- }
- public String getUsername() {
- return username;
- }
- public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest request) {
- /**@todo: finish this method, this is just the skeleton.*/
- ActionErrors errors=new ActionErrors();
- if(request.getParameter("username").equals("lsb")&& request.getParameter("password").equals("bsl")){
- errors=null;
- request.setAttribute("logattem",new Boolean(true));
- }else{
- errors.add(username,new ActionError("invalid user"));
- request.setAttribute("logattem",new Boolean(false));
- }
- return errors;
- }
- public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
- }
- }