1
2
3
4
5 package hu.elte.tribus.form;
6
7 import javax.servlet.http.HttpServletRequest;
8
9 import org.apache.struts.action.ActionError;
10 import org.apache.struts.action.ActionErrors;
11 import org.apache.struts.action.ActionForm;
12 import org.apache.struts.action.ActionMapping;
13
14 /***
15 * MyEclipse Struts
16 * Creation date: 11-11-2006
17 *
18 * XDoclet definition:
19 * @struts.form name="profileForm"
20 */
21 public class ProfileForm extends ActionForm {
22
23
24
25
26 private int id;
27
28 /*** email property */
29 private String email;
30
31 /*** firstName property */
32 private String firstName;
33
34 /*** lastName property */
35 private String lastName;
36
37 private boolean admin;
38
39
40
41
42
43 public boolean isAdmin() {
44 return admin;
45 }
46
47 public void setAdmin(boolean admin) {
48 this.admin = admin;
49 }
50
51 /***
52 * Method validate
53 * @param mapping
54 * @param request
55 * @return ActionErrors
56 */
57 public ActionErrors validate(ActionMapping mapping,
58 HttpServletRequest request) {
59 ActionErrors errors = new ActionErrors();
60 if(getFirstName().equals("") || getLastName().equals(""))
61 {
62 errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.name.empty"));
63 }
64 if(getEmail().equals(""))
65 {
66 errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.email.empty"));
67 }
68 if(errors.size() == 0)
69 {
70 return null;
71 }
72 else
73 {
74 return errors;
75 }
76 }
77
78 /***
79 * Method reset
80 * @param mapping
81 * @param request
82 */
83 public void reset(ActionMapping mapping, HttpServletRequest request) {
84
85 }
86
87 /***
88 * Returns the email.
89 * @return String
90 */
91 public String getEmail() {
92 return email;
93 }
94
95 /***
96 * Set the email.
97 * @param email The email to set
98 */
99 public void setEmail(String email) {
100 this.email = email;
101 }
102
103 /***
104 * Returns the firstName.
105 * @return String
106 */
107 public String getFirstName() {
108 return firstName;
109 }
110
111 /***
112 * Set the firstName.
113 * @param firstName The firstName to set
114 */
115 public void setFirstName(String firstName) {
116 this.firstName = firstName;
117 }
118
119 /***
120 * Returns the lastName.
121 * @return String
122 */
123 public String getLastName() {
124 return lastName;
125 }
126
127 /***
128 * Set the lastName.
129 * @param lastName The lastName to set
130 */
131 public void setLastName(String lastName) {
132 this.lastName = lastName;
133 }
134
135 public int getId() {
136 return id;
137 }
138
139 public void setId(int id) {
140 this.id = id;
141 }
142 }