Source Code Cross Referenced for RegistrationForm.java in  » Web-Framework » struts-1.3.8 » org » apache » struts » webapp » example » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » struts 1.3.8 » org.apache.struts.webapp.example 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: RegistrationForm.java 471754 2006-11-06 14:55:09Z husted $
003:         *
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *  http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:
022:        package org.apache.struts.webapp.example;
023:
024:        import javax.servlet.http.HttpServletRequest;
025:
026:        import org.apache.struts.action.ActionErrors;
027:        import org.apache.struts.action.ActionMessage;
028:        import org.apache.struts.action.ActionMapping;
029:        import org.apache.struts.validator.ValidatorForm;
030:
031:        /**
032:         * Form bean for the user registration page.  This form has the following
033:         * fields, with default values in square brackets:
034:         * <ul>
035:         * <li><b>action</b> - The maintenance action we are performing (Create,
036:         *     Delete, or Edit).
037:         * <li><b>fromAddress</b> - The EMAIL address of the sender, to be included
038:         *     on sent messages.  [REQUIRED]
039:         * <li><b>fullName</b> - The full name of the sender, to be included on
040:         *     sent messages.  [REQUIRED]
041:         * <li><b>password</b> - The password used by this user to log on.
042:         * <li><b>password2</b> - The confirmation password, which must match
043:         *     the password when changing or setting.
044:         * <li><b>replyToAddress</b> - The "Reply-To" address to be included on
045:         *     sent messages.  [Same as from address]
046:         * <li><b>username</b> - The registered username, which must be unique.
047:         *     [REQUIRED]
048:         * </ul>
049:         *
050:         * @author Craig R. McClanahan
051:         * @version $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $
052:         */
053:
054:        public final class RegistrationForm extends ValidatorForm {
055:
056:            // ----------------------------------------------------- Instance Variables
057:
058:            /**
059:             * The maintenance action we are performing (Create or Edit).
060:             */
061:            private String action = "Create";
062:
063:            /**
064:             * The from address.
065:             */
066:            private String fromAddress = null;
067:
068:            /**
069:             * The full name.
070:             */
071:            private String fullName = null;
072:
073:            /**
074:             * The password.
075:             */
076:            private String password = null;
077:
078:            /**
079:             * The confirmation password.
080:             */
081:            private String password2 = null;
082:
083:            /**
084:             * The reply to address.
085:             */
086:            private String replyToAddress = null;
087:
088:            /**
089:             * The username.
090:             */
091:            private String username = null;
092:
093:            // ----------------------------------------------------------- Properties
094:
095:            /**
096:             * Return the maintenance action.
097:             */
098:            public String getAction() {
099:
100:                return (this .action);
101:
102:            }
103:
104:            /**
105:             * Set the maintenance action.
106:             *
107:             * @param action The new maintenance action.
108:             */
109:            public void setAction(String action) {
110:
111:                this .action = action;
112:
113:            }
114:
115:            /**
116:             * Return the from address.
117:             */
118:            public String getFromAddress() {
119:
120:                return (this .fromAddress);
121:
122:            }
123:
124:            /**
125:             * Set the from address.
126:             *
127:             * @param fromAddress The new from address
128:             */
129:            public void setFromAddress(String fromAddress) {
130:
131:                this .fromAddress = fromAddress;
132:
133:            }
134:
135:            /**
136:             * Return the full name.
137:             */
138:            public String getFullName() {
139:
140:                return (this .fullName);
141:
142:            }
143:
144:            /**
145:             * Set the full name.
146:             *
147:             * @param fullName The new full name
148:             */
149:            public void setFullName(String fullName) {
150:
151:                this .fullName = fullName;
152:
153:            }
154:
155:            /**
156:             * Return the password.
157:             */
158:            public String getPassword() {
159:
160:                return (this .password);
161:
162:            }
163:
164:            /**
165:             * Set the password.
166:             *
167:             * @param password The new password
168:             */
169:            public void setPassword(String password) {
170:
171:                this .password = password;
172:
173:            }
174:
175:            /**
176:             * Return the confirmation password.
177:             */
178:            public String getPassword2() {
179:
180:                return (this .password2);
181:
182:            }
183:
184:            /**
185:             * Set the confirmation password.
186:             *
187:             * @param password2 The new confirmation password
188:             */
189:            public void setPassword2(String password2) {
190:
191:                this .password2 = password2;
192:
193:            }
194:
195:            /**
196:             * Return the reply to address.
197:             */
198:            public String getReplyToAddress() {
199:
200:                return (this .replyToAddress);
201:
202:            }
203:
204:            /**
205:             * Set the reply to address.
206:             *
207:             * @param replyToAddress The new reply to address
208:             */
209:            public void setReplyToAddress(String replyToAddress) {
210:
211:                this .replyToAddress = replyToAddress;
212:
213:            }
214:
215:            /**
216:             * Return the username.
217:             */
218:            public String getUsername() {
219:
220:                return (this .username);
221:
222:            }
223:
224:            /**
225:             * Set the username.
226:             *
227:             * @param username The new username
228:             */
229:            public void setUsername(String username) {
230:
231:                this .username = username;
232:
233:            }
234:
235:            // --------------------------------------------------------- Public Methods
236:
237:            /**
238:             * Reset all properties to their default values.
239:             *
240:             * @param mapping The mapping used to select this instance
241:             * @param request The servlet request we are processing
242:             */
243:            public void reset(ActionMapping mapping, HttpServletRequest request) {
244:
245:                this .action = "Create";
246:                this .fromAddress = null;
247:                this .fullName = null;
248:                this .password = null;
249:                this .password2 = null;
250:                this .replyToAddress = null;
251:                this .username = null;
252:
253:            }
254:
255:            /**
256:             * Validate the properties that have been set from this HTTP request,
257:             * and return an <code>ActionMessages</code> object that encapsulates any
258:             * validation errors that have been found.  If no errors are found, return
259:             * <code>null</code> or an <code>ActionMessages</code> object with no
260:             * recorded error messages.
261:             *
262:             * @param mapping The mapping used to select this instance
263:             * @param request The servlet request we are processing
264:             */
265:            public ActionErrors validate(ActionMapping mapping,
266:                    HttpServletRequest request) {
267:
268:                // Perform validator framework validations
269:                ActionErrors errors = super .validate(mapping, request);
270:
271:                // Only need crossfield validations here
272:                if (((password == null) && (password2 != null))
273:                        || ((password != null) && (password2 == null))
274:                        || ((password != null) && (password2 != null) && !password
275:                                .equals(password2))) {
276:                    errors.add("password2", new ActionMessage(
277:                            "error.password.match"));
278:                }
279:                return errors;
280:
281:            }
282:
283:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.