Source Code Cross Referenced for SubscriptionForm.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: SubscriptionForm.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:        import org.apache.struts.action.ActionErrors;
026:        import org.apache.struts.action.ActionMessage;
027:        import org.apache.struts.action.ActionForm;
028:        import org.apache.struts.action.ActionMapping;
029:
030:        /**
031:         * Form bean for the user profile page.  This form has the following fields,
032:         * with default values in square brackets:
033:         * <ul>
034:         * <li><b>action</b> - The maintenance action we are performing (Create, Delete,
035:         *     or Edit).
036:         * <li><b>host</b> - The mail host for this subscription.  [REQUIRED]
037:         * <li><b>password</b> - The password for this subscription.  [REQUIRED]
038:         * <li><b>type</b> - The subscription type (imap,pop3)
039:         for this subscription.  [REQUIRED]
040:         * <li><b>username</b> - The username of this subscription.  [REQUIRED]
041:         * </ul>
042:         *
043:         * @author Craig R. McClanahan
044:         * @version $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $
045:         */
046:
047:        public final class SubscriptionForm extends ActionForm {
048:
049:            // --------------------------------------------------- Instance Variables
050:
051:            /**
052:             * The maintenance action we are performing (Create or Edit).
053:             */
054:            private String action = "Create";
055:
056:            /**
057:             * Should we auto-connect at startup time?
058:             */
059:            private boolean autoConnect = false;
060:
061:            /**
062:             * The host name.
063:             */
064:            private String host = null;
065:
066:            /**
067:             * The password.
068:             */
069:            private String password = null;
070:
071:            /**
072:             * The subscription type.
073:             */
074:            private String type = null;
075:
076:            /**
077:             * The username.
078:             */
079:            private String username = null;
080:
081:            // ----------------------------------------------------------- Properties
082:
083:            /**
084:             * Return the maintenance action.
085:             */
086:            public String getAction() {
087:
088:                return (this .action);
089:
090:            }
091:
092:            /**
093:             * Set the maintenance action.
094:             *
095:             * @param action The new maintenance action.
096:             */
097:            public void setAction(String action) {
098:
099:                this .action = action;
100:
101:            }
102:
103:            /**
104:             * Return the auto-connect flag.
105:             */
106:            public boolean getAutoConnect() {
107:
108:                return (this .autoConnect);
109:
110:            }
111:
112:            /**
113:             * Set the auto-connect flag.
114:             *
115:             * @param autoConnect The new auto-connect flag
116:             */
117:            public void setAutoConnect(boolean autoConnect) {
118:
119:                this .autoConnect = autoConnect;
120:            }
121:
122:            /**
123:             * Return the host name.
124:             */
125:            public String getHost() {
126:
127:                return (this .host);
128:
129:            }
130:
131:            /**
132:             * Set the host name.
133:             *
134:             * @param host The host name
135:             */
136:            public void setHost(String host) {
137:
138:                this .host = host;
139:
140:            }
141:
142:            /**
143:             * Return the password.
144:             */
145:            public String getPassword() {
146:
147:                return (this .password);
148:
149:            }
150:
151:            /**
152:             * Set the password.
153:             *
154:             * @param password The new password
155:             */
156:            public void setPassword(String password) {
157:
158:                this .password = password;
159:
160:            }
161:
162:            /**
163:             * Return the subscription type.
164:             */
165:            public String getType() {
166:
167:                return (this .type);
168:
169:            }
170:
171:            /**
172:             * Set the subscription type.
173:             *
174:             * @param type The subscription type
175:             */
176:            public void setType(String type) {
177:
178:                this .type = type;
179:
180:            }
181:
182:            /**
183:             * Return the username.
184:             */
185:            public String getUsername() {
186:
187:                return (this .username);
188:
189:            }
190:
191:            /**
192:             * Set the username.
193:             *
194:             * @param username The new username
195:             */
196:            public void setUsername(String username) {
197:
198:                this .username = username;
199:
200:            }
201:
202:            // --------------------------------------------------------- Public Methods
203:
204:            /**
205:             * Reset all properties to their default values.
206:             *
207:             * @param mapping The mapping used to select this instance
208:             * @param request The servlet request we are processing
209:             */
210:            public void reset(ActionMapping mapping, HttpServletRequest request) {
211:
212:                this .action = "Create";
213:                this .autoConnect = false;
214:                this .host = null;
215:                this .password = null;
216:                this .type = null;
217:                this .username = null;
218:
219:            }
220:
221:            /**
222:             * Validate the properties that have been set from this HTTP request,
223:             * and return an <code>ActionMessages</code> object that encapsulates any
224:             * validation errors that have been found.  If no errors are found, return
225:             * <code>null</code> or an <code>ActionMessages</code> object with no
226:             * recorded error messages.
227:             *
228:             * @param mapping The mapping used to select this instance
229:             * @param request The servlet request we are processing
230:             */
231:            public ActionErrors validate(ActionMapping mapping,
232:                    HttpServletRequest request) {
233:
234:                ActionErrors errors = new ActionErrors();
235:
236:                if ((host == null) || (host.length() < 1))
237:                    errors
238:                            .add("host", new ActionMessage(
239:                                    "error.host.required"));
240:                if ((username == null) || (username.length() < 1))
241:                    errors.add("username", new ActionMessage(
242:                            "error.username.required"));
243:                if ((password == null) || (password.length() < 1))
244:                    errors.add("password", new ActionMessage(
245:                            "error.password.required"));
246:                if ((type == null) || (type.length() < 1))
247:                    errors
248:                            .add("type", new ActionMessage(
249:                                    "error.type.required"));
250:                else if (!"imap".equals(type) && !"pop3".equals(type))
251:                    errors.add("type", new ActionMessage("error.type.invalid",
252:                            type));
253:
254:                return (errors);
255:
256:            }
257:
258:            /**
259:             * <p>Return a string representation of this form bean.</p>
260:             */
261:            public String toString() {
262:
263:                StringBuffer sb = new StringBuffer(super .toString());
264:                sb.append(",action=");
265:                sb.append(action);
266:                sb.append(",autoConnect=");
267:                sb.append(autoConnect);
268:                sb.append(",host=");
269:                sb.append(host);
270:                sb.append(",password=");
271:                sb.append(password);
272:                sb.append(",type=");
273:                sb.append(type);
274:                sb.append(",username=");
275:                sb.append(username);
276:                return (sb.toString());
277:
278:            }
279:
280:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.