| 1 package com.quikj.application.communicator.admin.controller; 2 3 import javax.servlet.http.HttpServletRequest ; 4 import org.apache.struts.action.ActionError; 5 import org.apache.struts.action.ActionErrors; 6 import org.apache.struts.action.ActionForm; 7 import org.apache.struts.action.ActionMapping; 8 9 10 21 22 public final class LogonForm extends ActionForm { 23 24 25 27 28 31 private String password = null; 32 33 34 37 private String username = null; 38 39 40 42 43 46 public String getPassword() { 47 48 return (this.password); 49 50 } 51 52 53 58 public void setPassword(String password) { 59 60 this.password = password; 61 62 } 63 64 65 68 public String getUsername() { 69 70 return (this.username); 71 72 } 73 74 75 80 public void setUsername(String username) { 81 82 this.username = username; 83 84 } 85 86 87 89 90 96 public void reset(ActionMapping mapping, HttpServletRequest request) { 97 98 this.password = null; 99 this.username = null; 100 101 } 102 103 104 114 public ActionErrors validate(ActionMapping mapping, 115 HttpServletRequest request) { 116 117 ActionErrors errors = new ActionErrors(); 118 if ((username == null) || (username.length() < 1)) 119 errors.add("username", new ActionError("error.username.required")); 120 if ((password == null) || (password.length() < 1)) 121 errors.add("password", new ActionError("error.password.required")); 122 123 return errors; 124 125 } 126 127 128 } 129 | Popular Tags |