Source Code Cross Referenced for LoginForm.java in  » GIS » GeoServer » org » vfny » geoserver » form » 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 » GIS » GeoServer » org.vfny.geoserver.form 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Feb 3, 2004
003:         *
004:         * To change the template for this generated file go to
005:         * Window - Preferences - Java - Code Generation - Code and Comments
006:         */
007:        package org.vfny.geoserver.form;
008:
009:        import org.apache.struts.Globals;
010:        import org.apache.struts.action.ActionError;
011:        import org.apache.struts.action.ActionErrors;
012:        import org.apache.struts.action.ActionForm;
013:        import org.apache.struts.action.ActionMapping;
014:        import org.apache.struts.util.MessageResources;
015:        import java.util.Locale;
016:        import javax.servlet.http.HttpServletRequest;
017:
018:        /**
019:         * LoginForm purpose.
020:         * <p>
021:         * Stores the username/password information for the login page, to be used by the LoginAction
022:         * </p>
023:         *
024:         * @author rgould, Refractions Research, Inc.
025:         * @author $Author: dmzwiers $ (last modification)
026:         * @version $Id: LoginForm.java 6177 2007-02-19 10:11:27Z aaime $
027:         */
028:        public class LoginForm extends ActionForm {
029:            /**
030:             * Comment for <code>serialVersionUID</code>
031:             */
032:            private static final long serialVersionUID = 3258410616858358324L;
033:            private String username;
034:            private String password;
035:            private String confirm;
036:
037:            /**
038:             *
039:             * sets username and password to empty strings
040:             *
041:             * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
042:             *
043:             * @param arg0
044:             * @param request
045:             */
046:            public void reset(ActionMapping arg0, HttpServletRequest request) {
047:                super .reset(arg0, request);
048:
049:                username = "";
050:                password = "";
051:                confirm = "";
052:            }
053:
054:            /**
055:             *
056:             * Verifies that username is not null or empty.
057:             * Could potentially do the same for password later.
058:             *
059:             * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
060:             *
061:             * @param mapping
062:             * @param request
063:             * @return
064:             */
065:            public ActionErrors validate(ActionMapping mapping,
066:                    HttpServletRequest request) {
067:                ActionErrors errors = new ActionErrors();
068:
069:                Locale locale = (Locale) request.getLocale();
070:
071:                //MessageResources messages = servlet.getResources();
072:                //TODO: not sure about this, changed for struts 1.2.8 upgrade
073:                MessageResources messages = (MessageResources) request
074:                        .getAttribute(Globals.MESSAGES_KEY);
075:
076:                String usernameLabel = messages.getMessage(locale,
077:                        "label.username");
078:                String passwordLabel = messages.getMessage(locale,
079:                        "label.password");
080:
081:                if ((username == null) || username.equals("")) {
082:                    errors.add("username", new ActionError("errors.required",
083:                            usernameLabel));
084:                }
085:
086:                if ((password == null) || password.equals("")) {
087:                    errors.add("password", new ActionError("errors.required",
088:                            passwordLabel));
089:                }
090:
091:                //failed experiment, as it looks like Login and LoginEdit use the same
092:                //form, which means that confirm will always be null on the normal.
093:                //I think the best course of action would be to have a LoginEditForm,
094:                //which extends this class, just adding the confirm stuff, and does the
095:                //validate with the confirm.  We don't want the normal login using
096:                //the validate, which is why this experiment failed.  Shouldn't be
097:                //too hard, it's just getting late and I've spent too much time on this
098:                //already.
099:
100:                //if (confirm == null || !confirm.equals(password)) {
101:                //    errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.password.mismatch"));
102:                //}
103:                return errors;
104:            }
105:
106:            /**
107:             * Access password property.
108:             *
109:             * @return Returns the password.
110:             */
111:            public String getPassword() {
112:                return password;
113:            }
114:
115:            /**
116:             * Set password to password.
117:             *
118:             * @param password The password to set.
119:             */
120:            public void setPassword(String password) {
121:                this .password = password;
122:            }
123:
124:            /**
125:             * Access username property.
126:             *
127:             * @return Returns the username.
128:             */
129:            public String getUsername() {
130:                return username;
131:            }
132:
133:            /**
134:             * Set username to username.
135:             *
136:             * @param username The username to set.
137:             */
138:            public void setUsername(String username) {
139:                this .username = username;
140:            }
141:
142:            public String getConfirm() {
143:                return confirm;
144:            }
145:
146:            public void setConfirm(String confirm) {
147:                this.confirm = confirm;
148:            }
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.