Commits

Anonymous committed f89ec34

Issue number: ww-997

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@687e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (1)

src/java/com/opensymphony/xwork/validator/validators/VisitorFieldValidator.java

 
 
 /**
- * The VisitorFieldValidator allows you to forward validation to object
+ * <!-- START SNIPPET: javadoc -->
+ * <p>The VisitorFieldValidator allows you to forward validation to object
  * properties of your action using the object's own validation files.  This
  * allows you to use the ModelDriven development pattern and manage your
  * validations for your models in one place, where they belong, next to your
  * model classes.  The VisitorFieldValidator can handle either simple Object
- * properties, Collections of Objects, or Arrays.
+ * properties, Collections of Objects, or Arrays.</p>
+ *<!-- END SNIPPET: javadoc -->
+ *
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <ul>
+ *    <li>fieldName - field name if plain-validator syntax is used, not needed if field-validator syntax is used</li>
+ *    <li>context - the context of which validation should take place. Optional</li>
+ *    <li>appendPrefix - the prefix to be added to field. Optional </li>
+ * </ul>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ *    &lt;validators&gt;
+ *        &lt;!-- Plain Validator Syntax --&gt;
+ *        &lt;validator type="visitor"&gt;
+ *            &lt;param name="fieldName"&gt;user&lt;/param&gt;
+ *            &lt;param name="context"&gt;myContext&lt;/param&gt;
+ *            &lt;param name="appendPrefix"&gt;true&lt;/param&gt;
+ *        &lt;/validator&gt;
+ *        
+ *        &lt;!-- Field Validator Syntax --&gt;
+ *        &lt;field name="user"&gt;
+ *           &lt;field-validator type="visitor"&gt;
+ *              &lt;param name="context"&gt;myContext&lt;/param&gt;
+ *              &lt;param name="appendPrefix"&gt;true&lt;/param&gt;
+ *           &lt;/field-validator&gt;
+ *        &lt;/field&gt;
+ *    &lt;/validators&gt;
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ * 
+ * <!-- START SNIPPET: explanation -->
+ * <p>In the example above, if the acion's getUser() method return User object, WebWork
+ * will look for User-myContext-validation.xml for the validators. Since appednPrefix is true,
+ * every field name will be prefixed with 'user' such that if the actual field name for 'name' is  
+ * 'user.name' </p>
+ * <!-- END SNIPPET: explanation -->
+ * 
+ * 
  *
  * @author Jason Carreira
  * @author Rainer Hermanns
- *         Created Aug 2, 2003 10:27:48 PM
+ * @version $Date$ $Id$
  */
 public class VisitorFieldValidator extends FieldValidatorSupport {
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.