struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1397252 - /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidator.java
Date Thu, 11 Oct 2012 19:32:48 GMT
Author: lukaszlenart
Date: Thu Oct 11 19:32:48 2012
New Revision: 1397252

URL: http://svn.apache.org/viewvc?rev=1397252&view=rev
Log:
WW-3888 updates documentation regarding expression evaluation

Modified:
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidator.java

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidator.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidator.java?rev=1397252&r1=1397251&r2=1397252&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidator.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidator.java
Thu Oct 11 19:32:48 2012
@@ -15,7 +15,6 @@
  */
 package com.opensymphony.xwork2.validator.validators;
 
-
 /**
  * <!-- START SNIPPET: javadoc -->
  * Field Validator that checks if the integer specified is within a certain range.
@@ -28,34 +27,49 @@ package com.opensymphony.xwork2.validato
  * 		<li>min - the minimum value (if none is specified, it will not be checked) </li>
  * 		<li>max - the maximum value (if none is specified, it will not be checked) </li>
  * </ul>
+ *
+ * The min / max value can be specified as an expression, but then you must also enable parsing
it by specifying <strong>parse</strong> param
+ * as in the example below.
+ * WARNING! Do not use ${min} and ${max} as an expression as this will turn into infinitive
loop!
+ *
  * <!-- END SNIPPET: parameters -->
  * 
  * 
  * <pre>
  * <!-- START SNIPPET: examples -->
- * 		&lt;validators>
- *           &lt;!-- Plain Validator Syntax --&gt;
- *           &lt;validator type="int">
- *               &lt;param name="fieldName"&gt;age&lt;/param&gt;
- *               &lt;param name="min"&gt;20&lt;/param&gt;
- *               &lt;param name="max"&gt;50&lt;/param&gt;
- *               &lt;message&gt;Age needs to be between ${min} and ${max}&lt;/message&gt;
- *           &lt;/validator&gt;
- *           
- *           &lt;!-- Field Validator Syntax --&gt;
- *           &lt;field name="age"&gt;
- *               &lt;field-validator type="int"&gt;
- *                   &lt;param name="min"&gt;20&lt;/param&gt;
- *                   &lt;param name="max"&gt;50&lt;/param&gt;
- *                   &lt;message&gt;Age needs to be between ${min} and ${max}&lt;/message&gt;
- *               &lt;/field-validator&gt;
- *           &lt;/field&gt;
- *      &lt;/validators&gt;
+ *	&lt;validators>
+ *      &lt;!-- Plain Validator Syntax --&gt;
+ *      &lt;validator type="int">
+ *          &lt;param name="fieldName"&gt;age&lt;/param&gt;
+ *          &lt;param name="min"&gt;20&lt;/param&gt;
+ *          &lt;param name="max"&gt;50&lt;/param&gt;
+ *          &lt;message&gt;Age needs to be between ${min} and ${max}&lt;/message&gt;
+ *      &lt;/validator&gt;
+ *
+ *      &lt;!-- Field Validator Syntax --&gt;
+ *      &lt;field name="age"&gt;
+ *          &lt;field-validator type="int"&gt;
+ *              &lt;param name="min"&gt;20&lt;/param&gt;
+ *              &lt;param name="max"&gt;50&lt;/param&gt;
+ *              &lt;message&gt;Age needs to be between ${min} and ${max}&lt;/message&gt;
+ *          &lt;/field-validator&gt;
+ *      &lt;/field&gt;
+ *
+ *      &lt;!-- Field Validator Syntax with expression --&gt;
+ *      &lt;field name="age"&gt;
+ *          &lt;field-validator type="int"&gt;
+ *              &lt;param name="parse"&gt;true&lt;/param&gt;
+ *              &lt;param name="${minValue}"&gt;20&lt;/param&gt; &lt;!--
will be evaluated as: Integer getMinValue() --&gt;
+ *              &lt;param name="${maxValue}"&gt;50&lt;/param&gt; &lt;!--
will be evaluated as: Integer getMaxValue() --&gt;
+ *              &lt;message&gt;Age needs to be between ${min} and ${max}&lt;/message&gt;
+ *          &lt;/field-validator&gt;
+ *      &lt;/field&gt;
+ * &lt;/validators&gt;
  * <!-- END SNIPPET: examples -->
  * </pre>
  * 
- * 
- * 
+ *
+ *
  * @author Jason Carreira
  * @version $Date$ $Id$
  */



Mime
View raw message