Repository: struts-site Updated Branches: refs/heads/asf-site 5474d2180 -> 740bd3f6d
Updates production by Jenkins Project: http://git-wip-us.apache.org/repos/asf/struts-site/repo Commit: http://git-wip-us.apache.org/repos/asf/struts-site/commit/740bd3f6 Tree: http://git-wip-us.apache.org/repos/asf/struts-site/tree/740bd3f6 Diff: http://git-wip-us.apache.org/repos/asf/struts-site/diff/740bd3f6 Branch: refs/heads/asf-site Commit: 740bd3f6de3297b9b815466a4a00e2b386ce5f09 Parents: 5474d21 Author: jenkins <bui...@apache.org> Authored: Mon Sep 11 19:58:52 2017 +0000 Committer: jenkins <bui...@apache.org> Committed: Mon Sep 11 19:58:52 2017 +0000 ---------------------------------------------------------------------- .../conditionalvisitor-validator.html | 25 ++++--- content/core-developers/email-validator.html | 66 ++++++++++++------ .../fieldexpression-validator.html | 47 ++++++++----- content/core-developers/regex-validator.html | 63 ++++++++++++------ content/core-developers/short-validator.html | 66 ++++++++++++------ .../core-developers/stringlength-validator.html | 70 +++++++++++++------- content/core-developers/visitor-validator.html | 51 ++++++++------ 7 files changed, 253 insertions(+), 135 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts-site/blob/740bd3f6/content/core-developers/conditionalvisitor-validator.html ---------------------------------------------------------------------- diff --git a/content/core-developers/conditionalvisitor-validator.html b/content/core-developers/conditionalvisitor-validator.html index 940fa38..1e5b76d 100644 --- a/content/core-developers/conditionalvisitor-validator.html +++ b/content/core-developers/conditionalvisitor-validator.html @@ -127,22 +127,25 @@ <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/conditionalvisitor-validator.md" title="Edit this page on GitHub">Edit on GitHub</a> <h1 id="conditionalvisitor-validator">conditionalvisitor validator</h1> -<p>####Description####</p> +<h3 id="description">Description</h3> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=javadoc|javadoc=true|url=com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> +<p>The ConditionalVisitorFieldValidator will forward validation to the VisitorFieldValidator only if the expression will evaluate to true.</p> -<p>####Parameters####</p> +<h3 id="parameters">Parameters</h3> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> +<ul> + <li><code class="highlighter-rouge">expression</code> - an OGNL expression which should evaluate to true to pass validation to the VisitorFieldValidator.</li> +</ul> -<p>####Examples####</p> +<h3 id="examples">Examples</h3> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> +<div class="highlighter-rouge"><pre class="highlight"><code><field name="colleaguePosition"> + <field-validator type="conditionalvisitor"> + <param name="expression">reason == 'colleague' and colleaguePositionID == 'OTHER'</param> + <message>You must select reason Colleague and position Other</message> + </field-validator> +</field> +</code></pre> </div> </section> http://git-wip-us.apache.org/repos/asf/struts-site/blob/740bd3f6/content/core-developers/email-validator.html ---------------------------------------------------------------------- diff --git a/content/core-developers/email-validator.html b/content/core-developers/email-validator.html index 4fc50d8..a5969a5 100644 --- a/content/core-developers/email-validator.html +++ b/content/core-developers/email-validator.html @@ -127,36 +127,60 @@ <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/email-validator.md" title="Edit this page on GitHub">Edit on GitHub</a> <h1 id="email-validator">email validator</h1> -<p>####Description####</p> +<h3 id="description">Description</h3> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=javadoc|javadoc=true|url=com.opensymphony.xwork2.validator.validators.EmailValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> +<p>EmailValidator checks that a given String field, if not empty, is a valid email address.</p> -<p>####Parameters####</p> +<p>The regular expression used to validate that the string is an email address is:</p> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.validators.EmailValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> +<div class="highlighter-rouge"><pre class="highlight"><code>\\b^['_a-z0-9-\\+](\\.['_a-z0-9-\\+])@[a-z0-9-](\\.[a-z0-9-])\\.([a-z]{2,6})$\\b +</code></pre> </div> -<p><strong>(!) Warning</strong></p> +<p>You can also specify <code class="highlighter-rouge">expression</code>, <code class="highlighter-rouge">caseSensitive</code> and <code class="highlighter-rouge">trim</code> params as a OGNL expression, see the example below.</p> + +<h3 id="parameters">Parameters</h3> + +<ul> + <li><code class="highlighter-rouge">fieldName</code> - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required.</li> +</ul> + +<p>Check also documentation of the <code class="highlighter-rouge">RegexpValidator</code> for more details - the EmailValidator is based on it.</p> <blockquote> - <table> - <tbody> - <tr> - <td>{snippet:id=parameters-warning</td> - <td>javadoc=true</td> - <td>url=com.opensymphony.xwork2.validator.validators.EmailValidator}</td> - </tr> - </tbody> - </table> + <p>Warning +Do not use <code class="highlighter-rouge">${regexExpression}</code>, <code class="highlighter-rouge">${caseSensitiveExpression}</code> and <code class="highlighter-rouge">${trimExpression}</code> as an expression as this will turn into infinitive loop!</p> </blockquote> -<p>####Examples####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.validator.validators.EmailValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> +<h3 id="examples">Examples</h3> + +<div class="highlighter-rouge"><pre class="highlight"><code><!-- Plain Validator Syntax --> +<validators> + <validator type="email"> + <param name="fieldName">myEmail</param> + <message>Must provide a valid email</message> + </validator> +</validators> + +<!-- Field Validator Syntax --> +<field name="myEmail"> + <field-validator type="email"> + <message>Must provide a valid email</message> + </field-validator> +</field> + +<!-- Field Validator Syntax with expressions --> +<!-- Only available when used with xml based configuration, if you want to have the same + flexibility with annotations use @RegexFieldValidator instead --> +<field name="myEmail"> + <field-validator type="email"> + <param name="regexExpression">${emailPattern}</param> <!-- will be evaluated as: String getEmailPattern() --> + <param name="caseSensitiveExpression">${emailCaseSensitive}</param> <!-- will be evaluated as: boolean getEmailCaseSensitive() --> + <param name="trimExpression">${trimEmail}</param> <!-- will be evaluated as: boolean getTrimEmail() --> + <message>Must provide a valid email</message> + </field-validator> +</field> +</code></pre> </div> </section> http://git-wip-us.apache.org/repos/asf/struts-site/blob/740bd3f6/content/core-developers/fieldexpression-validator.html ---------------------------------------------------------------------- diff --git a/content/core-developers/fieldexpression-validator.html b/content/core-developers/fieldexpression-validator.html index ddc1c9f..76ea4fa 100644 --- a/content/core-developers/fieldexpression-validator.html +++ b/content/core-developers/fieldexpression-validator.html @@ -127,22 +127,37 @@ <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/fieldexpression-validator.md" title="Edit this page on GitHub">Edit on GitHub</a> <h1 id="fieldexpression-validator">fieldexpression validator</h1> -<p>####Description####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=javadoc|javadoc=true|url=com.opensymphony.xwork2.validator.validators.FieldExpressionValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> - -<p>####Parameters####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.validators.FieldExpressionValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> - -<p>####Examples####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=example|javadoc=true|lang=xml|url=com.opensymphony.xwork2.validator.validators.FieldExpressionValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> +<h3 id="description">Description</h3> + +<p>Validates a field using an OGNL expression.</p> + +<h3 id="parameters">Parameters</h3> + +<ul> + <li><code class="highlighter-rouge">fieldName</code> - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required.</li> + <li><code class="highlighter-rouge">expression</code> - The Ognl expression (must evaluate to a boolean) which is to be validated the stack.</li> +</ul> + +<h3 id="examples">Examples</h3> + +<div class="highlighter-rouge"><pre class="highlight"><code><!-- Plain Validator Syntax --> +<validators> + <!-- Plain Validator Syntax --> + <validator type="fieldexpression"> + <param name="fieldName">myField</param> + <param name="expression"><![CDATA[#myCreditLimit > #myGirfriendCreditLimit]]></param> + <message>My credit limit should be MORE than my girlfriend</message> + <validator> + + <!-- Field Validator Syntax --> + <field name="myField"> + <field-validator type="fieldexpression"> + <param name="expression"><![CDATA[#myCreditLimit > #myGirfriendCreditLimit]]></param> + <message>My credit limit should be MORE than my girlfriend</message> + </field-validator> + </field> +</vaidators> +</code></pre> </div> </section> http://git-wip-us.apache.org/repos/asf/struts-site/blob/740bd3f6/content/core-developers/regex-validator.html ---------------------------------------------------------------------- diff --git a/content/core-developers/regex-validator.html b/content/core-developers/regex-validator.html index c970729..ad86a0e 100644 --- a/content/core-developers/regex-validator.html +++ b/content/core-developers/regex-validator.html @@ -127,36 +127,55 @@ <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/regex-validator.md" title="Edit this page on GitHub">Edit on GitHub</a> <h1 id="regex-validator">regex validator</h1> -<p>####Description####</p> +<h3 id="description">Description</h3> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=javadoc|javadoc=true|url=com.opensymphony.xwork2.validator.validators.RegexFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> +<p>Validates a string field using a regular expression.</p> -<p>####Parameters####</p> +<h3 id="parameters">Parameters</h3> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.validators.RegexFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> +<ul> + <li><code class="highlighter-rouge">fieldName</code> - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required.</li> + <li><code class="highlighter-rouge">regexp</code> - The RegExp expression</li> + <li><code class="highlighter-rouge">caseSensitive</code> - Boolean (Optional). Sets whether the expression should be matched against in a case-sensitive way. Default is true.</li> + <li><code class="highlighter-rouge">trim</code> - Boolean (Optional). Sets whether the expression should be trimmed before matching. Default is true.</li> + <li><code class="highlighter-rouge">regexExpression</code> - String (Optional). Defines regExp expression as an OGNL expression - will be evaluated to String.</li> + <li><code class="highlighter-rouge">caseSensitiveExpression</code> - String (Optional). Defines <code class="highlighter-rouge">caseSensitive</code> param as an OGNL expression - will be evaluated to Boolean.</li> + <li><code class="highlighter-rouge">trimExpression</code> - String (Optional). Defines trim param as an OGNL expression - will be evaluated to Boolean.</li> +</ul> -<p><strong>(!) Warning</strong></p> +<p>You can mix normal params with expression aware params but thus was not tested.</p> <blockquote> - <table> - <tbody> - <tr> - <td>{snippet:id=parameters-warning</td> - <td>javadoc=true</td> - <td>url=com.opensymphony.xwork2.validator.validators.RegexFieldValidator}</td> - </tr> - </tbody> - </table> + <p>Warning +Do not use <code class="highlighter-rouge">${regexExpression}</code>, <code class="highlighter-rouge">${caseSensitiveExpression}</code> and <code class="highlighter-rouge">${trimExpression}</code> as an expression as this will turn into infinitive loop!</p> </blockquote> -<p>####Examples####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=example|javadoc=true|lang=xml|url=com.opensymphony.xwork2.validator.validators.RegexFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> +<h3 id="examples">Examples</h3> + +<div class="highlighter-rouge"><pre class="highlight"><code><validators> + <!-- Plain Validator Syntax --> + <validator type="regex"> + <param name="fieldName">myStrangePostcode</param> + <param name="regex"><![CDATA[([aAbBcCdD][123][eEfFgG][456])]]></param> + </validator> + + <!-- Field Validator Syntax --> + <field name="myStrangePostcode"> + <field-validator type="regex"> + <param name="regex"><![CDATA[([aAbBcCdD][123][eEfFgG][456])]]></param> + </field-validator> + </field> + + <!-- Field Validator Syntax with expressions --> + <field name="myStrangePostcode"> + <field-validator type="regex"> + <param name="regexExpression">${regexValue}</param> <!-- will be evaluated as: String getRegexValue() --> + <param name="caseSensitiveExpression">${caseSensitiveValue}</param> <!-- will be evaluated as: boolean getCaseSensitiveValue() --> + <param name="trimExpression">${trimValue}</param> <!-- will be evaluated as: boolean getTrimValue() --> + </field-validator> + </field> +</validators> +</code></pre> </div> </section> http://git-wip-us.apache.org/repos/asf/struts-site/blob/740bd3f6/content/core-developers/short-validator.html ---------------------------------------------------------------------- diff --git a/content/core-developers/short-validator.html b/content/core-developers/short-validator.html index 650be3d..7113dbb 100644 --- a/content/core-developers/short-validator.html +++ b/content/core-developers/short-validator.html @@ -127,36 +127,58 @@ <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/short-validator.md" title="Edit this page on GitHub">Edit on GitHub</a> <h1 id="short-validator">short validator</h1> -<p>####Description####</p> +<h3 id="description">Description</h3> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=javadoc|javadoc=true|url=com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> +<p>Field Validator that checks if the short specified is within a certain range.</p> -<p>####Parameters####</p> +<h3 id="parameters">Parameters</h3> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> +<ul> + <li><code class="highlighter-rouge">fieldName</code> - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required.</li> + <li><code class="highlighter-rouge">min</code> - the minimum value (if none is specified, it will not be checked).</li> + <li><code class="highlighter-rouge">max</code> - the maximum value (if none is specified, it will not be checked).</li> + <li><code class="highlighter-rouge">parse</code> - if set to true, minExpression and maxExpression will be evaluated to find min/max.</li> + <li><code class="highlighter-rouge">minExpression</code> - expression to calculate the minimum value (if none is specified, it will not be checked).</li> + <li><code class="highlighter-rouge">maxExpression</code> - expression to calculate the maximum value (if none is specified, it will not be checked).</li> +</ul> -<p><strong>(!) Warning</strong></p> +<p>You can either use the <code class="highlighter-rouge">min</code> / <code class="highlighter-rouge">max</code> value or <code class="highlighter-rouge">minExpression</code> / <code class="highlighter-rouge">maxExpression</code> (when <code class="highlighter-rouge">parse</code> is set to <code class="highlighter-rouge">true</code>) - using expression can be slightly slower, see the example below.</p> <blockquote> - <table> - <tbody> - <tr> - <td>{snippet:id=parameters-warning</td> - <td>javadoc=true</td> - <td>url=com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator}</td> - </tr> - </tbody> - </table> + <p>Warning +Do not use <code class="highlighter-rouge">${minExpression}</code> and <code class="highlighter-rouge">${maxExpression}</code> as an expression as this will turn into infinitive loop!</p> </blockquote> -<p>####Examples####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=example|javadoc=true|lang=xml|url=com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> +<h3 id="examples">Examples</h3> + +<div class="highlighter-rouge"><pre class="highlight"><code><validators> + <!-- Plain Validator Syntax --> + <validator type="short"> + <param name="fieldName">age</param> + <param name="min">20</param> + <param name="max">50</param> + <message>Age needs to be between ${min} and ${max}</message> + </validator> + + <!-- Field Validator Syntax --> + <field name="age"> + <field-validator type="short"> + <param name="min">20</param> + <param name="max">50</param> + <message>Age needs to be between ${min} and ${max}</message> + </field-validator> + </field> + + <!-- Field Validator Syntax with expression --> + <field name="age"> + <field-validator type="short"> + <param name="minExpression">${minValue}</param> <!-- will be evaluated as: Short getMinValue() --> + <param name="maxExpression">${maxValue}</param> <!-- will be evaluated as: Short getMaxValue() --> + <message>Age needs to be between ${min} and ${max}</message> + </field-validator> + </field> +</validators> +</code></pre> </div> </section> http://git-wip-us.apache.org/repos/asf/struts-site/blob/740bd3f6/content/core-developers/stringlength-validator.html ---------------------------------------------------------------------- diff --git a/content/core-developers/stringlength-validator.html b/content/core-developers/stringlength-validator.html index 641dd27..3074ce1 100644 --- a/content/core-developers/stringlength-validator.html +++ b/content/core-developers/stringlength-validator.html @@ -127,36 +127,60 @@ <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/stringlength-validator.md" title="Edit this page on GitHub">Edit on GitHub</a> <h1 id="stringlength-validator">stringlength validator</h1> -<p>####Description####</p> +<h3 id="description">Description</h3> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=javadoc|javadoc=true|url=com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> - -<p>####Parameters####</p> +<p>StringLengthFieldValidator checks that a String field is of a certain length. If the <code class="highlighter-rouge">minLength</code> parameter is specified, it will make sure that the String has at least that many characters. If the <code class="highlighter-rouge">maxLength</code> parameter is specified, it will make sure that the String has at most that many characters. The <code class="highlighter-rouge">trim</code> parameter determines whether it will <code class="highlighter-rouge">String#trim()</code> the String before performing the length check. If unspecified, the String will be trimmed.</p> -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> +<h3 id="parameters">Parameters</h3> -<p><strong>(!) Warning</strong></p> +<ul> + <li><code class="highlighter-rouge">fieldName</code> - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required.</li> + <li><code class="highlighter-rouge">maxLength</code> - Integer. The max length of the field value. Default ignore.</li> + <li><code class="highlighter-rouge">minLength</code> - Integer. The min length of the field value. Default ignore.</li> + <li><code class="highlighter-rouge">trim</code> - (Optional) Boolean, default true. Trim the field value before evaluating its min/max length. Default true.</li> + <li><code class="highlighter-rouge">maxLengthExpression</code> - (Optional) String. Defines the max length param as an OGNL expression.</li> + <li><code class="highlighter-rouge">minLengthExpression</code> - (Optional) String. Defines the min length param as an OGNL expression.</li> + <li><code class="highlighter-rouge">trimExpression</code> - (Optional) String. Defines th trim param as an OGNL expression.</li> +</ul> <blockquote> - <table> - <tbody> - <tr> - <td>{snippet:id=parameters-warning</td> - <td>javadoc=true</td> - <td>url=com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator}</td> - </tr> - </tbody> - </table> + <p>Warning +Do not use <code class="highlighter-rouge">${minLengthExpression}</code>, <code class="highlighter-rouge">${maxLengthExpression}</code> and <code class="highlighter-rouge">${trimExpression}</code> as an expression as this will turn into infinitive loop!</p> </blockquote> -<p>####Examples####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=example|javadoc=true|lang=xml|url=com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> +<h3 id="examples">Examples</h3> + +<div class="highlighter-rouge"><pre class="highlight"><code><validators> + <!-- Plain Validator Syntax --> + <validator type="stringlength"> + <param name="fieldName">myPurchaseCode</param> + <param name="minLength">10</param> + <param name="maxLength">10</param> + <param name="trim">true</param> + <message>Your purchase code needs to be 10 characters long</message> + </validator> + + <!-- Field Validator Syntax --> + <field name="myPurchaseCode"> + <field-validator type="stringlength"> + <param name="minLength">10</param> + <param name="maxLength">10</param> + <param name="trim">true</param> + <message>Your purchase code needs to be 10 characters long</message> + </field-validator> + </field> + + <!-- Field Validator Syntax with expression --> + <field name="myPurchaseCode"> + <field-validator type="stringlength"> + <param name="minLengthExpression">${minLengthValue}</param> <!-- will be evaluated as: Integer getMinLengthValue() --> + <param name="maxLengthExpression">${maxLengthValue}</param> <!-- will be evaluated as: Integer getMaxLengthValue() --> + <param name="trimExpression">${trimValue}</param> <!-- will be evaluated as: boolean getTrimValue() --> + <message>Your purchase code needs to be 10 characters long</message> + </field-validator> + </field> +</validators> +</code></pre> </div> </section> http://git-wip-us.apache.org/repos/asf/struts-site/blob/740bd3f6/content/core-developers/visitor-validator.html ---------------------------------------------------------------------- diff --git a/content/core-developers/visitor-validator.html b/content/core-developers/visitor-validator.html index 0e9558a..6068c86 100644 --- a/content/core-developers/visitor-validator.html +++ b/content/core-developers/visitor-validator.html @@ -127,26 +127,37 @@ <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/visitor-validator.md" title="Edit this page on GitHub">Edit on GitHub</a> <h1 id="visitor-validator">visitor validator</h1> -<p>####Description####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=javadoc|javadoc=true|url=com.opensymphony.xwork2.validator.validators.VisitorFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> - -<p>####Parameters####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.validators.VisitorFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> - -<p>####Examples####</p> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.validator.validators.VisitorFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> -</div> - -<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">snippet:id=explanation|javadoc=true|url=com.opensymphony.xwork2.validator.validators.VisitorFieldValidator</span><span class="p">}</span><span class="w"> -</span></code></pre> +<h3 id="description">Description</h3> + +<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 <code class="highlighter-rouge">ModelDriven</code> 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.</p> + +<h3 id="parameters">Parameters</h3> + +<ul> + <li><code class="highlighter-rouge">fieldName</code> - field name if plain-validator syntax is used, not needed if field-validator syntax is used.</li> + <li><code class="highlighter-rouge">context</code> - the context of which validation should take place. Optional.</li> + <li><code class="highlighter-rouge">appendPrefix</code> - the prefix to be added to field. Optional.</li> +</ul> + +<h3 id="examples">Examples</h3> + +<div class="highlighter-rouge"><pre class="highlight"><code><validators> + <!-- Plain Validator Syntax --> + <validator type="visitor"> + <param name="fieldName">user</param> + <param name="context">myContext</param> + <param name="appendPrefix">true</param> + </validator> + + <!-- Field Validator Syntax --> + <field name="user"> + <field-validator type="visitor"> + <param name="context">myContext</param> + <param name="appendPrefix">true</param> + </field-validator> + </field> +</validators> +</code></pre> </div> </section>