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 2002/12/17 08:21:05 UTC

cvs commit: jakarta-struts/doc/userGuide building_view.xml

dgraham     2002/12/16 23:21:05

  Modified:    doc/userGuide building_view.xml
  Log:
  Filled in Validator section 3.3.5 with basic setup instructions.
  
  Revision  Changes    Path
  1.19      +29 -1     jakarta-struts/doc/userGuide/building_view.xml
  
  Index: building_view.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/doc/userGuide/building_view.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- building_view.xml	30 Nov 2002 22:25:16 -0000	1.18
  +++ building_view.xml	17 Dec 2002 07:21:05 -0000	1.19
  @@ -536,7 +536,35 @@
         </section>
   
       <section name="3.3.5 The Struts Validator" href="validator">
  -    <p>[:TODO:]</p>
  +    <p>
  +    Configuring the Validator to perform form validation is easy.<br/>
  +    <ol>
  +    	<li>The ActionForm bean must extend ValidatorForm</li>
  +    	<li>The form's JSP must include the <a href="struts-html.html">&lt;html:javascript&gt;</a> tag for client side validation.</li>
  +    	<li>You must define the validation rules in an xml file like this:<br/>
  +    <pre>
  +	    &lt;form-validation>
  +			&lt;formset>         	   
  +      			&lt;form name="logonForm">
  +         			&lt;field property="username" depends="required">
  +         				&lt;msg name="required" key="error.username"/>
  +         			&lt;/field>    
  +    			&lt;/form>        
  +			&lt;/formset>   
  +		&lt;/form-validation>
  +    </pre>
  +    <br/>
  +    The msg element points to the message resource key to use when generating the error message.
  +    </li>
  +    <li>Lastly, you must enable the ValidatorPlugin in the struts-config.xml file like this:<br/>
  +	<pre>
  +    &lt;plug-in className="org.apache.struts.validator.ValidatorPlugIn">
  +    	&lt;set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
  +  	&lt;/plug-in>
  +  	</pre>
  +    </li>
  +    </ol>
  +    </p>
       </section>
   
       <section name="3.3.6 Indexed &amp; Mapped Properties" href="indexed">
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>