1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.tuigwaa.controller;
17
18 import javax.servlet.http.HttpServletRequest;
19
20 import org.apache.struts.action.ActionErrors;
21 import org.apache.struts.action.ActionMapping;
22 import org.apache.struts.action.ActionMessage;
23 import org.apache.struts.action.ActionMessages;
24 import org.apache.struts.validator.ValidatorForm;
25
26 /***
27 * @author someda
28 */
29 public class UserForm extends ValidatorForm {
30
31 private static final long serialVersionUID = -8743153463218216811L;
32
33 private String name;
34 private String password;
35 private String passwordconfirm;
36 private String[] roles;
37 private String otherattributes;
38 private String description;
39 private boolean modify = false;
40
41 public UserForm(){
42 }
43
44 public String getDescription() {
45 return description;
46 }
47
48 public void setDescription(String description) {
49 this.description = description;
50 }
51
52 public String getName() {
53 return name;
54 }
55
56 public void setName(String name) {
57 this.name = name;
58 }
59
60 public String getOtherattributes() {
61 return otherattributes;
62 }
63
64 public void setOtherattributes(String otherattributes) {
65 this.otherattributes = otherattributes;
66 }
67
68 public String getPassword() {
69 return password;
70 }
71
72 public void setPassword(String password) {
73 this.password = password;
74 }
75
76 public String getPasswordconfirm() {
77 return passwordconfirm;
78 }
79
80 public void setPasswordconfirm(String passwordconfirm) {
81 this.passwordconfirm = passwordconfirm;
82 }
83
84 public String[] getRoles() {
85 return roles;
86 }
87
88 public void setRoles(String[] roles) {
89 this.roles = roles;
90 }
91
92 public boolean isModify() {
93 return modify;
94 }
95
96 public void setModify(boolean modify) {
97 this.modify = modify;
98 }
99
100 public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {
101
102 if(!getPassword().equals(getPasswordconfirm())){
103 ActionMessages msgs = new ActionMessages();
104 msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("userform.confirm"));
105 ActionErrors errors = new ActionErrors();
106 errors.add(msgs);
107 return errors;
108 }
109 return super.validate(mapping, request);
110 }
111 }