01 package com.bea.medrec.beans;
02
03 import javax.servlet.http.HttpServletRequest;
04 import org.apache.struts.action.ActionErrors;
05 import org.apache.struts.action.ActionMapping;
06 import org.apache.struts.validator.Resources;
07
08 /**
09 * <p>Form bean containing create administrator user data. Used in
10 * creating Admin user.
11 * </p>
12 *
13 * @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
14 */
15 public class CreateAdminBean extends AdminBean {
16 // Instance Variables
17 protected String password = "";
18 protected String confirmpassword = "";
19
20 // Constructors
21 public CreateAdminBean() {
22 }
23
24 public CreateAdminBean(String pUsername,
25 String pPassword,
26 String pConfirmpassword) {
27 this.username = pUsername;
28 this.password = pPassword;
29 this.confirmpassword = pConfirmpassword;
30 }
31
32 // Getters
33 public String getPassword() {
34 return this.password;
35 }
36
37 public String getConfirmpassword() {
38 return this.confirmpassword;
39 }
40
41 // Setters
42 public void setPassword(String pPassword) {
43 this.password = pPassword;
44 }
45
46 public void setConfirmpassword(String pConfirmpassword) {
47 this.confirmpassword = pConfirmpassword;
48 }
49
50
51 /**
52 * <p>Validate Create New Admin.</p>
53 *
54 * @param mapping
55 * @param request
56 * @return ActionErrors
57 */
58 public ActionErrors validate(ActionMapping mapping,
59 HttpServletRequest request) {
60 ActionErrors errors = new ActionErrors();
61 // only validate if the user has clicked "Login"
62 String loginSubmit = Resources.getMessage(request, "button.Create");
63 if (loginSubmit.equals(request.getParameter("action"))) {
64 errors = super.validate(mapping, request);
65 }
66 return errors;
67 }
68
69 }
|