KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > backoffice > form > EditUserForm


1 package org.nextime.ion.backoffice.form;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4
5 import org.apache.struts.action.ActionError;
6 import org.apache.struts.action.ActionErrors;
7 import org.apache.struts.action.ActionForm;
8 import org.apache.struts.action.ActionMapping;
9
10 public class EditUserForm extends ActionForm {
11
12     private String JavaDoc name;
13     private String JavaDoc email;
14     private String JavaDoc password;
15     private String JavaDoc[] groups;
16
17     /**
18      * @see org.apache.struts.action.ActionForm#validate(ActionMapping, HttpServletRequest)
19      */

20     public ActionErrors myValidate(HttpServletRequest JavaDoc request) {
21         ActionErrors errors = new ActionErrors();
22         if ("".equals(getName()) || getName()==null) {
23             ActionError error =
24                 new ActionError("error.editUser.nameMissing");
25             errors.add("name", error);
26         }
27         if ("".equals(getEmail()) || getEmail()==null) {
28             ActionError error =
29                 new ActionError("error.editUser.emailMissing");
30             errors.add("email", error);
31         }
32         if ("".equals(getPassword()) || getPassword()==null) {
33             ActionError error =
34                 new ActionError("error.editUser.passwordMissing");
35             errors.add("password", error);
36         }
37         return errors;
38     }
39
40     /**
41      * @see org.apache.struts.action.ActionForm#reset(ActionMapping, HttpServletRequest)
42      */

43     public void reset(ActionMapping arg0, HttpServletRequest JavaDoc arg1) {
44         setName(null);
45         setEmail(null);
46         setGroups(null);
47         setPassword(null);
48     }
49
50     
51     /**
52      * Returns the email.
53      * @return String
54      */

55     public String JavaDoc getEmail() {
56         return email;
57     }
58
59
60     /**
61      * Returns the groups.
62      * @return String[]
63      */

64     public String JavaDoc[] getGroups() {
65         if( groups == null ) {
66             return new String JavaDoc[0];
67         }
68         return groups;
69     }
70
71
72     /**
73      * Returns the name.
74      * @return String
75      */

76     public String JavaDoc getName() {
77         return name;
78     }
79
80
81     /**
82      * Sets the email.
83      * @param email The email to set
84      */

85     public void setEmail(String JavaDoc email) {
86         this.email = email;
87     }
88
89
90     /**
91      * Sets the groups.
92      * @param groups The groups to set
93      */

94     public void setGroups(String JavaDoc[] groups) {
95         this.groups = groups;
96     }
97
98
99     /**
100      * Sets the name.
101      * @param name The name to set
102      */

103     public void setName(String JavaDoc name) {
104         this.name = name;
105     }
106
107
108     /**
109      * Returns the password.
110      * @return String
111      */

112     public String JavaDoc getPassword() {
113         return password;
114     }
115
116
117     /**
118      * Sets the password.
119      * @param password The password to set
120      */

121     public void setPassword(String JavaDoc password) {
122         this.password = password;
123     }
124
125
126 }
127
Popular Tags