struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r392119 - in /struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example: LogonAction.java LogonForm.java RegistrationForm.java SaveRegistrationAction.java SubscriptionForm.java
Date Thu, 06 Apr 2006 23:35:00 GMT
Author: mrdon
Date: Thu Apr  6 16:34:58 2006
New Revision: 392119

URL: http://svn.apache.org/viewcvs?rev=392119&view=rev
Log:
Fixing ActionError usage

Modified:
    struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonAction.java
    struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonForm.java
    struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/RegistrationForm.java
    struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SaveRegistrationAction.java
    struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SubscriptionForm.java

Modified: struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonAction.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonAction.java?rev=392119&r1=392118&r2=392119&view=diff
==============================================================================
--- struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonAction.java
(original)
+++ struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonAction.java
Thu Apr  6 16:34:58 2006
@@ -25,8 +25,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts.action.Action;
-import org.apache.struts.action.ActionError;
-import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
@@ -83,7 +83,7 @@
 	User user = null;
 
 	// Validate the request parameters specified by the user
-	ActionErrors errors = new ActionErrors();
+	ActionMessages errors = new ActionMessages();
 	String username = (String)
             PropertyUtils.getSimpleProperty(form, "username");
         String password = (String)
@@ -91,15 +91,15 @@
 	UserDatabase database = (UserDatabase)
 	  servlet.getServletContext().getAttribute(Constants.DATABASE_KEY);
 	if (database == null)
-            errors.add(ActionErrors.GLOBAL_ERROR,
-                       new ActionError("error.database.missing"));
+            errors.add(ActionMessages.GLOBAL_MESSAGE,
+                       new ActionMessage("error.database.missing"));
 	else {
 	    user = getUser(database, username);
 	    if ((user != null) && !user.getPassword().equals(password))
 		user = null;
 	    if (user == null)
-                errors.add(ActionErrors.GLOBAL_ERROR,
-                           new ActionError("error.password.mismatch"));
+                errors.add(ActionMessages.GLOBAL_MESSAGE,
+                           new ActionMessage("error.password.mismatch"));
 	}
 
 	// Report any errors we have discovered back to the original form

Modified: struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonForm.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonForm.java?rev=392119&r1=392118&r2=392119&view=diff
==============================================================================
--- struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonForm.java
(original)
+++ struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/LogonForm.java
Thu Apr  6 16:34:58 2006
@@ -19,8 +19,8 @@
 
 
 import javax.servlet.http.HttpServletRequest;
-import org.apache.struts.action.ActionError;
-import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionMapping;
 
@@ -121,22 +121,22 @@
 
     /**
      * Validate the properties that have been set from this HTTP request,
-     * and return an <code>ActionErrors</code> object that encapsulates any
+     * and return an <code>ActionMessages</code> object that encapsulates any
      * validation errors that have been found.  If no errors are found, return
-     * <code>null</code> or an <code>ActionErrors</code> object with
no
+     * <code>null</code> or an <code>ActionMessages</code> object
with no
      * recorded error messages.
      *
      * @param mapping The mapping used to select this instance
      * @param request The servlet request we are processing
      */
-    public ActionErrors validate(ActionMapping mapping,
+    public ActionMessages validate(ActionMapping mapping,
                                  HttpServletRequest request) {
 
-        ActionErrors errors = new ActionErrors();
+        ActionMessages errors = new ActionMessages();
         if ((username == null) || (username.length() < 1))
-            errors.add("username", new ActionError("error.username.required"));
+            errors.add("username", new ActionMessage("error.username.required"));
         if ((password == null) || (password.length() < 1))
-            errors.add("password", new ActionError("error.password.required"));
+            errors.add("password", new ActionMessage("error.password.required"));
 
         return errors;
 

Modified: struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/RegistrationForm.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/RegistrationForm.java?rev=392119&r1=392118&r2=392119&view=diff
==============================================================================
--- struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/RegistrationForm.java
(original)
+++ struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/RegistrationForm.java
Thu Apr  6 16:34:58 2006
@@ -20,8 +20,8 @@
 
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.struts.action.ActionError;
-import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
 import org.apache.struts.action.ActionMapping;
 import org.apache.struts.validator.ValidatorForm;
 
@@ -279,19 +279,19 @@
 
     /**
      * Validate the properties that have been set from this HTTP request,
-     * and return an <code>ActionErrors</code> object that encapsulates any
+     * and return an <code>ActionMessages</code> object that encapsulates any
      * validation errors that have been found.  If no errors are found, return
-     * <code>null</code> or an <code>ActionErrors</code> object with
no
+     * <code>null</code> or an <code>ActionMessages</code> object
with no
      * recorded error messages.
      *
      * @param mapping The mapping used to select this instance
      * @param request The servlet request we are processing
      */
-    public ActionErrors validate(ActionMapping mapping,
+    public ActionMessages validate(ActionMapping mapping,
                                  HttpServletRequest request) {
 
         // Perform validator framework validations
-        ActionErrors errors = super.validate(mapping, request);
+        ActionMessages errors = super.validate(mapping, request);
 
         // Only need crossfield validations here
         if (((password == null) && (password2 != null)) ||
@@ -299,7 +299,7 @@
             ((password != null) && (password2 != null) &&
              !password.equals(password2))) {
             errors.add("password2",
-                       new ActionError("error.password.match"));
+                       new ActionMessage("error.password.match"));
         }
         return errors;
 

Modified: struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SaveRegistrationAction.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SaveRegistrationAction.java?rev=392119&r1=392118&r2=392119&view=diff
==============================================================================
--- struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SaveRegistrationAction.java
(original)
+++ struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SaveRegistrationAction.java
Thu Apr  6 16:34:58 2006
@@ -30,8 +30,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.struts.action.Action;
-import org.apache.struts.action.ActionError;
-import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
@@ -119,13 +119,13 @@
 	}
 
         // Validate the transactional control token
-	ActionErrors errors = new ActionErrors();
+	ActionMessages errors = new ActionMessages();
         if (log.isTraceEnabled()) {
             log.trace(" Checking transactional control token");
         }
         if (!isTokenValid(request)) {
-            errors.add(ActionErrors.GLOBAL_ERROR,
-                       new ActionError("error.transaction.token"));
+            errors.add(ActionMessages.GLOBAL_MESSAGE,
+                       new ActionMessage("error.transaction.token"));
         }
         resetToken(request);
 
@@ -138,19 +138,19 @@
 	if (("Create".equals(action)) &&
             (database.findUser(value) != null)) {
             errors.add("username",
-                       new ActionError("error.username.unique",
+                       new ActionMessage("error.username.unique",
                                        regform.getUsername()));
         }
 	if ("Create".equals(action)) {
 	    value = regform.getPassword();
 	    if ((value == null) || (value.length() <1)) {
                 errors.add("password",
-                           new ActionError("error.password.required"));
+                           new ActionMessage("error.password.required"));
             }
 	    value = regform.getPassword2();
 	    if ((value == null) || (value.length() < 1)) {
                 errors.add("password2",
-                           new ActionError("error.password2.required"));
+                           new ActionMessage("error.password2.required"));
             }
 	}
 

Modified: struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SubscriptionForm.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SubscriptionForm.java?rev=392119&r1=392118&r2=392119&view=diff
==============================================================================
--- struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SubscriptionForm.java
(original)
+++ struts/action/trunk/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/SubscriptionForm.java
Thu Apr  6 16:34:58 2006
@@ -19,8 +19,8 @@
 
 
 import javax.servlet.http.HttpServletRequest;
-import org.apache.struts.action.ActionError;
-import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionMapping;
 
@@ -241,34 +241,34 @@
 
     /**
      * Validate the properties that have been set from this HTTP request,
-     * and return an <code>ActionErrors</code> object that encapsulates any
+     * and return an <code>ActionMessages</code> object that encapsulates any
      * validation errors that have been found.  If no errors are found, return
-     * <code>null</code> or an <code>ActionErrors</code> object with
no
+     * <code>null</code> or an <code>ActionMessages</code> object
with no
      * recorded error messages.
      *
      * @param mapping The mapping used to select this instance
      * @param request The servlet request we are processing
      */
-    public ActionErrors validate(ActionMapping mapping,
+    public ActionMessages validate(ActionMapping mapping,
                                  HttpServletRequest request) {
 
-        ActionErrors errors = new ActionErrors();
+        ActionMessages errors = new ActionMessages();
 
 	if ((host == null) || (host.length() < 1))
             errors.add("host",
-                       new ActionError("error.host.required"));
+                       new ActionMessage("error.host.required"));
 	if ((username == null) || (username.length() < 1))
             errors.add("username",
-                       new ActionError("error.username.required"));
+                       new ActionMessage("error.username.required"));
 	if ((password == null) || (password.length() < 1))
             errors.add("password",
-                       new ActionError("error.password.required"));
+                       new ActionMessage("error.password.required"));
 	if ((type == null) || (type.length() < 1))
             errors.add("type",
-                       new ActionError("error.type.required"));
+                       new ActionMessage("error.type.required"));
 	else if (!"imap".equals(type) && !"pop3".equals(type))
             errors.add("type",
-                       new ActionError("error.type.invalid", type));
+                       new ActionMessage("error.type.invalid", type));
 
 	return (errors);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message