husted 2002/12/27 02:24:06 Modified: doc/userGuide dev_validator.xml Log: Minor structural changes to existing content. Revision Changes Path 1.18 +114 -82 jakarta-struts/doc/userGuide/dev_validator.xml Index: dev_validator.xml =================================================================== RCS file: /home/cvs/jakarta-struts/doc/userGuide/dev_validator.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- dev_validator.xml 27 Dec 2002 09:53:39 -0000 1.17 +++ dev_validator.xml 27 Dec 2002 10:24:05 -0000 1.18 @@ -6,9 +6,9 @@ --> <properties> - <author>David Winterfeldt</author> - <author>James Turner</author> - <author>Rob Leland</author> + <author>David Winterfeldt</author> + <author>James Turner</author> + <author>Rob Leland</author> <title>The Struts User's Guide - Validator Guide</title> </properties> @@ -18,48 +18,32 @@ <section href="validator" name="Struts Validator"> -<p> -[:TODO:] -</p> + <p> + The Struts Validator, in some form, has been available since the + days of Struts 0.5. + It was orignally packaged as a developer contribution. + Later, the core code was moved to the Jakarta Commons and + a Struts specific extension became part of Struts 1.1. + </p> -<p> -Cover basic functionality as documented on David's web site. -<a href="http://home.earthlink.net/~dwinterfeldt/">Validation Framework for -Struts </a> -</p> + <p> + For the convenience of the many developers who have been using + the Struts Validator all along, this document first overviews + the core functionality and then covers the changes and + new functionality added in the Struts 1.1. + </p> + + <p> + [:TODO: Cover basic functionality as documented on David's web site. + <a href="http://home.earthlink.net/~dwinterfeldt/">Validation Framework for + Struts </a>] + </p> <p> -Changes in the validator behavior and deprecation of functionality from +Changes in the validator behavior and deprecation of functionality from original validator </p> -<ul> - - <li> - The validator xml files now <strong>validates against the DTD stored in the - commons-validator.jar </strong>! - </li> - - <li> - The default validator-rules.xml now ignores blank fields for all the basic - validation types. - If you require a field to be present then to your applications validator.xml - field definition add "required" to the depends attribute. - </li> - - <li> - The Javascript Tag has new attributes defined. - </li> - - <li> - Deprecation of <code>range</code> methods in both JavaScript and Java - </li> - - <li> - Deprecation of StrutsValidator & StrutsValidatorUtil - </li> - -</ul> <p> Struts 1.1 has also added additional functionality over the original validator @@ -73,7 +57,7 @@ </li> <li> -<code>intRange</code> & <code>floatRange</code> methods in both JavaScript +<code>intRange</code> & <code>floatRange</code> methods in both JavaScript and Java </li> @@ -84,17 +68,25 @@ <section href="validator-bugs" name="Known Bugs"> <p> - Current know bugs can be found by clicking: - <a href="http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&bug_severity=Blocker&bug_severity=Critical&bug_severity=Major&bug_severity=Normal&bug_severity=Minor&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Struts&version=1.1+Beta+1&version=1.1+Beta+2&version=Nightly+Build&version=Unknown&component=Validator+Framework&short_desc=&short_desc_type=allwordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time"> - Validation Bugs</a> - </p> - - <p> - Since validation also relies on the commons-validator those bugs can be found - <a href="http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&bug_severity=Blocker&bug_severity=Critical&bug_severity=Major&bug_severity=Normal&bug_severity=Minor&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Commons&version=&component=Validator&short_desc=&short_desc_type=allwordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time"> - here</a> + Since the Struts Validator relies on the Commons Validator, problem + reports and enhancement requests may be listed against either product. </p> + <ul> + + <li> + <a href="http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&bug_severity=Blocker&bug_severity=Critical&bug_severity=Major&bug_severity=Normal&bug_severity=Minor&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Struts&version=1.1+Beta+1&version=1.1+Beta+2&version=Nightly+Build&version=Unknown&component=Validator+Framework&short_desc=&short_desc_type=allwordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&order=Bug+Number"> + Struts Validator Bugzilla Reports + </a> + </li> + + <li> + <a href="http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&bug_severity=Blocker&bug_severity=Critical&bug_severity=Major&bug_severity=Normal&bug_severity=Minor&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Commons&component=Validator&short_desc=&short_desc_type=allwordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&order=Bug+Number"> + Commons Validator Bugzilla Reports</a> + </li> + + </ul> + </section> <section href="validator-changes" name="Changes and deprecations"> @@ -104,18 +96,58 @@ </p> <p> - Struts no longer maintains a separate dtd for validator-rules.xml and + The validator xml files now <strong>validates against the DTD stored + in the commons-validator.jar </strong>! + Struts no longer maintains a separate dtd for validator-rules.xml and validator.xml. Additionally, commons-validator now maintains a unified validator.dtd. - Change all validator.xml DTD references to: - </p> - + Change all validator.xml DTD references to: + <pre><small><![CDATA[ <!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd"> ]]></small></pre> + </p> + + <p> + <strong>Blank fields.</strong> + </p> + + <p> + The default validator-rules.xml now ignores blank fields for all the + basic validation types. + If you require a field to be present then to your applications + validator.xml field definition add "required" to the depends + attribute. + </p> + + <p> + <strong>New tag attributes.</strong> + </p> + + <p> + The <a href="struts-html.html#javascript"><html:javascript> tag</a> + has new attributes defined. + </p> + + <p> + <strong>Deprecations.</strong> + </p> + + <ul> + + <li> + Deprecation of <code>range</code> methods in both JavaScript and Java. + </li> + + <li> + Deprecation of StrutsValidator & StrutsValidatorUtil. + </li> + + </ul> + </section> <section href="validator-new" name="New features"> @@ -125,9 +157,9 @@ </p> <p> - The most fundamental change is the ability to conditionally require + The most fundamental change is the ability to conditionally require validator fields based on the value of other fields. - It allows you to define logic like "only validate this field if field X is + It allows you to define logic like "only validate this field if field X is non-null and field Y equals 'male'". </p> @@ -140,22 +172,22 @@ </p> <pre><![CDATA[ -<form-bean +<form-bean name="dependentlistForm" type="org.apache.struts.webapp.validator.forms.ValidatorForm"> - <form-property - name="dependents" + <form-property + name="dependents" type="org.apache.struts.webapp.validator.Dependent[]" initial="{'','','','','','','','','','',''}"/> - <form-property + <form-property name="insureDependents" - type="java.lang.Boolean" + type="java.lang.Boolean" initial="false"/> </form-bean> ]]></pre> <p> - Where dependent is a bean that has properties lastName, firstName, dob, + Where dependent is a bean that has properties lastName, firstName, dob, coverageType </p> @@ -167,7 +199,7 @@ <form name="dependentlistForm"> -<field +<field property="firstName" indexedListProperty="dependents" depends="requiredif"> <arg0 key="dependentlistForm.firstName.label"/> @@ -185,9 +217,9 @@ </var> </field> -<field - property="dob" - indexedListProperty="dependents" +<field + property="dob" + indexedListProperty="dependents" depends="requiredif,date"> <arg0 key="dependentlistForm.dob.label"/> <var> @@ -195,22 +227,22 @@ <var-value>lastName</var-value> </var> <var> - <var-name>field-indexed[0]</var-name> + <var-name>field-indexed[0]</var-name> <var-value>true</var-value> </var> <var> - <var-name>field-test[0]</var-name> + <var-name>field-test[0]</var-name> <var-value>NOTNULL</var-value> </var> </field> -<field - property="coverageType" +<field + property="coverageType" indexedListProperty="dependents" depends="requiredif"> <arg0 key="dependentlistForm.coverageType.label"/> <var> - <var-name>field[0]</var-name> + <var-name>field[0]</var-name> <var-value>lastName</var-value> </var> <var> @@ -222,7 +254,7 @@ <var-value>NOTNULL</var-value> </var> <var> - <var-name>field[1]</var-name> + <var-name>field[1]</var-name> <var-value>insureDependents</var-value> </var> <var> @@ -245,20 +277,20 @@ <p> Which is read as follows: - The firstName field is only required if the lastName field is non-null. + The firstName field is only required if the lastName field is non-null. Since field-indexed is true, it means that lastName must be a property of - the same indexed field as firstName. + the same indexed field as firstName. Same thing for dob, except that we validate for date if not blank. </p> <p> - The coverageType is only required if the lastName for the same indexed - bean is not null, and also if the non-indexed field insureDependents is + The coverageType is only required if the lastName for the same indexed + bean is not null, and also if the non-indexed field insureDependents is true. </p> <p> - You can have an arbitrary number of fields by using the [n] syntax, + You can have an arbitrary number of fields by using the [n] syntax, the only restriction is that they must all be AND or OR, you can't mix. </p> @@ -267,9 +299,9 @@ <section href="tiles" name="Validator API Guide"> <p> - A concise + A concise <a href="http://jakarta.apache.org/struts/api/org/apache/struts/validator/package-summary.html#package_description"> - Struts Validator API Guide</a> is available to help you get started. + Struts Validator API Guide</a> is available to help you get started. </p> </section> @@ -279,17 +311,17 @@ <p> <a href="http://www.strutskickstart.com/"> <b>DynaForms and the Validator</b></a> by James Turner and Kevin Bedell. - Sample chapter from - <a href="http://www.strutskickstart.com/">Struts Kickstart</a>; + Sample chapter from + <a href="http://www.strutskickstart.com/">Struts Kickstart</a>; available as a free download (PDF). </p> <p> <a href="http://www.manning.com/getpage.html?project=husted&filename=chapters.html"> <b>Validating user input</b></a> by David Winterfeldt and Ted Husted. - Sample chapter from + Sample chapter from <a href="http://www.amazon.com/exec/obidos/ISBN=1930110502/hitchhikeguidetoA/"> - Struts in Action</a>; + Struts in Action</a>; available as a free download (PDF). </p>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>