You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by dg...@apache.org on 2005/05/29 06:12:53 UTC

svn commit: r178926 - in /struts/shale/trunk: core-library/src/java/org/apache/shale/component/ValidatorScript.java use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties use-cases/src/web/validator/test.jsp

Author: dgeary
Date: Sat May 28 21:12:52 2005
New Revision: 178926

URL: http://svn.apache.org/viewcvs?rev=178926&view=rev
Log:
I updated the javadocs for ValidatorScript.findCommonsValidators() to reflect handling of required validators. I also updated the validator use case so that we have a required validator on the server. (In an unrelated mod, I removed the required validator that was attached to the Amount field, because the field's converter provides 0.00 for empty input, thus obviating the need for the validatior). I updated the explanation of the validator use case in the JSP page, which meant changing Bundle.properties and Bundle_de.properties. I just copied the English text for the validation page from Bundle.properties to Bundle_de.properties; someone else will have to do the translation.

Modified:
    struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java
    struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties
    struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties
    struts/shale/trunk/use-cases/src/web/validator/test.jsp

Modified: struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java?rev=178926&r1=178925&r2=178926&view=diff
==============================================================================
--- struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java (original)
+++ struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java Sat May 28 21:12:52 2005
@@ -88,10 +88,13 @@
       if (id != null) map.put(id, v);
    }
 
-
     /**
-     * <p>Finds all of the Commons validators for all of the components
-     *    in a component hierarchy.
+     * <p>Recursively finds all Commons validators for the all of the
+	  *    components in a component hierarchy and adds them to a map. 
+	  * <p>If a validator's type is required, this method sets the 
+	  *    associated component's required property to true. This is 
+	  *    necessary because JSF does not validate empty fields unless 
+	  *    a component's required property is true.
      *
      * @param c The component at the root of the component tree
      * @param context The FacesContext for this request

Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties?rev=178926&r1=178925&r2=178926&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties (original)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties Sat May 28 21:12:52 2005
@@ -116,6 +116,8 @@
 usecases.title=Shale Framework Use Cases
 usecases.validator=Commons Validator Integration
 usecases.validate=Validation (client- and server-side)
+usecases.tiles=Tiles
+usecases.tiles.simple=A Simple Tiles Example
 
 # Validation
 validate.test.title=Shale Validation using Commons Validator
@@ -126,4 +128,10 @@
 validate.test.currency.symbol=$
 validate.test.unknown.credit.card.type=Unknown Credit Card Type
 validate.test.bad.expiration.date=Bad Expiration Date. Enter the date in this format: mm/dd/yyyy
-validate.test.description=This form has seven validators, all implemented with s:commonsValidator:<p><ul><li>Amount: <strong>required</strong> (client) and <strong>floatRange</strong> (server)<li>Credit Card Number: <strong>required</strong> (client) <strong>mask</strong> ([4-6].*) (client) and <strong>creditCard</strong> (server)<li>Expiration Date: <strong>required</strong> (client) <strong>date</strong> (server)</ul><p>Note: because of the Credit Card Number field's mix of client- and server-side validators, entering "33" in the field results in a JavaScript alert (because the mask validator catches it), but entering "55" results in server-side validation and a subsequent error message displayed in the form.<p>See the Apache Commons Validator documentation for more information about other available validators.
+validate.test.description=This form has six validators, all implemented with s:commonsValidator:<p><ul><li>Amount: <strong>floatRange</strong> (server)<li>Credit Card Number: <strong>required</strong> (server) <strong>mask</strong> ([4-6].*) (client) and <strong>creditCard</strong> (server)<li>Expiration Date: <strong>required</strong> (client) <strong>date</strong> (server)</ul><p>Note: because of the Credit Card Number field's mix of client- and server-side validators, entering "33" in the field results in a JavaScript alert (because the mask validator catches it), but entering "55" results in server-side validation and a subsequent error message displayed in the form.<p>See the Apache Commons Validator documentation for more information about other available validators.
+
+# Tiles
+tiles.test.title=Using Tiles with Shale
+tiles.test.thank.you.title=Thank You
+tiles.test.payment.heading=Please enter your payment information
+tiles.test.payment.thank.you.heading=Thank you for your payment!

Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties?rev=178926&r1=178925&r2=178926&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties (original)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties Sat May 28 21:12:52 2005
@@ -73,3 +73,14 @@
 usecases.logoff=Abmelden
 usecases.logon=Anmelde Dialog
 usecases.title=Shale Framework Use Cases
+
+# Validation (these need to be translated to German)
+validate.test.title=Shale Validation using Commons Validator
+validate.test.thank.you.title=Thank You
+validate.test.payment.heading=Please enter your payment information
+validate.test.payment.thank.you.heading=Thank you for your payment!
+validate.test.amount=Amount
+validate.test.currency.symbol=$
+validate.test.unknown.credit.card.type=Unknown Credit Card Type
+validate.test.bad.expiration.date=Bad Expiration Date. Enter the date in this format: mm/dd/yyyy
+validate.test.description=This form has six validators, all implemented with s:commonsValidator:<p><ul><li>Amount: <strong>floatRange</strong> (server)<li>Credit Card Number: <strong>required</strong> (server) <strong>mask</strong> ([4-6].*) (client) and <strong>creditCard</strong> (server)<li>Expiration Date: <strong>required</strong> (client) <strong>date</strong> (server)</ul><p>Note: because of the Credit Card Number field's mix of client- and server-side validators, entering "33" in the field results in a JavaScript alert (because the mask validator catches it), but entering "55" results in server-side validation and a subsequent error message displayed in the form.<p>See the Apache Commons Validator documentation for more information about other available validators.

Modified: struts/shale/trunk/use-cases/src/web/validator/test.jsp
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/validator/test.jsp?rev=178926&r1=178925&r2=178926&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/web/validator/test.jsp (original)
+++ struts/shale/trunk/use-cases/src/web/validator/test.jsp Sat May 28 21:12:52 2005
@@ -54,12 +54,6 @@
            minFractionDigits="2"/> 
 
             <s:commonsValidator 
-                        type="required"
-                         arg="#{messages['validate.test.amount']}"
-                      server="false" 
-                      client="true"/>
-
-            <s:commonsValidator 
                         type="floatRange"
                          min="10" 
                          max="1000" 
@@ -87,8 +81,8 @@
             <s:commonsValidator 
                         type="required"
                          arg="#{messages['prompt.creditCardNumber']}"
-                     server="false" 
-                     client="true"/>
+                     server="true" 
+                     client="false"/>
 
             <s:commonsValidator 
                         type="creditCard"



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