You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shale.apache.org by cr...@apache.org on 2006/09/30 21:32:12 UTC
svn commit: r451646 - in /shale/framework/trunk/shale-validator/src/site: ./
site.xml xdoc/ xdoc/index.xml
Author: craigmcc
Date: Sat Sep 30 12:32:11 2006
New Revision: 451646
URL: http://svn.apache.org/viewvc?view=rev&rev=451646
Log:
Initial website content for shale-validator.
SHALE-299
Added:
shale/framework/trunk/shale-validator/src/site/
shale/framework/trunk/shale-validator/src/site/site.xml (with props)
shale/framework/trunk/shale-validator/src/site/xdoc/
shale/framework/trunk/shale-validator/src/site/xdoc/index.xml (with props)
Added: shale/framework/trunk/shale-validator/src/site/site.xml
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-validator/src/site/site.xml?view=auto&rev=451646
==============================================================================
--- shale/framework/trunk/shale-validator/src/site/site.xml (added)
+++ shale/framework/trunk/shale-validator/src/site/site.xml Sat Sep 30 12:32:11 2006
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project name="Apache Shale Framework - View Controller Support">
+
+ <body>
+
+ <menu name="Shale Taglib Resources">
+ <item name="Tag Reference" href="/tagreference.html"/>
+ <item name="Taglibdoc" href="/tlddoc/index.html"/>
+ </menu>
+
+ <menu name="Quick Links">
+ <item name="JavaServer Faces"
+ href="http://java.sun.com/javaee/javaserverfaces/"/>
+ <item name="MyFaces"
+ href="http://myfaces.apache.org"/>
+ <item name="Shale"
+ href="http://shale.apache.org"/>
+ <item name="Shale Sandbox"
+ href="http://shale.apache.org/sandbox"/>
+ <item name="Struts"
+ href="http://struts.apache.org"/>
+ <item name="Struts-Faces Integration Library"
+ href="http://struts.apache.org/1.x/struts-faces"/>
+ </menu>
+
+ <menu name="Sub-Project Documentation">
+ <item name="Clay Plug-In" href="../shale-clay/index.html"/>
+ <item name="Core Library" href="../shale-core/index.html"/>
+ <item name="Spring Integration" href="../shale-spring/index.html"/>
+ <item name="Test Framework" href="../shale-test/index.html"/>
+ <item name="Tiles Integration" href="../shale-tiles/index.html"/>
+ <item name="Tiger Extensions" href="../shale-tiger/index.html"/>
+ <item name="Validator Support" href="../shale-validator/index.html"/>
+ <item name="View Controller" href="../shale-view/index.html"/>
+ </menu>
+
+ <menu name="Sample Apps Documentation">
+ <item name="Blank Starter" href="../shale-apps/shale-blank/index.html"/>
+ <item name="Clay Use Cases" href="../shale-apps/shale-clay-usecases/index.html"/>
+ <item name="Mail Reader" href="../shale-apps/shale-mailreader/index.html"/>
+ <item name="SQL Browser" href="../shale-apps/shale-sql-browser/index.html"/>
+ <item name="Use Cases" href="../shale-apps/shale-usecases/index.html"/>
+ </menu>
+
+ ${reports}
+
+ </body>
+
+</project>
+
+
+
+
+
Propchange: shale/framework/trunk/shale-validator/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: shale/framework/trunk/shale-validator/src/site/site.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: shale/framework/trunk/shale-validator/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-validator/src/site/xdoc/index.xml?view=auto&rev=451646
==============================================================================
--- shale/framework/trunk/shale-validator/src/site/xdoc/index.xml (added)
+++ shale/framework/trunk/shale-validator/src/site/xdoc/index.xml Sat Sep 30 12:32:11 2006
@@ -0,0 +1,164 @@
+<?xml version="1.0"?>
+<document>
+
+ <properties>
+ <title>Shale Commons Validator Integration</title>
+ </properties>
+
+ <body>
+
+ <section name="Commons Validator Integration">
+ <a name="validation"/>
+
+ <a name="validation-introduction"/>
+ <subsection name="Validation Introduction">
+
+ <p>JavaServer Faces 1.x does not explicitly support client-side
+ validation and only provides a minimal set of server-side
+ validators. On the other hand, <a href="http://jakarta.apache.org/commons/validator/">Apache Commons Validator</a>
+ supports both client- and server-side validators and comes
+ with the following useful validators:</p>
+
+ <ul>
+ <li>Credit Card</li>
+ <li>Date</li>
+ <li>Email</li>
+ <li>Generic</li>
+ <li>ISBN</li>
+ <li>URL</li>
+ </ul>
+
+ <p>All of the preceding validators can be executed either on
+ the client or the server, or both. Shale integrates JavaServer Faces
+ and the Commons Validator.</p>
+
+ </subsection>
+
+ <a name="validation-services"/>
+ <subsection name="Services Provided">
+
+ <p>Shale provides three JSP tags that let you use the Commons Validator:
+ <a href="shale-core/tagreference-taglib.html#s:commonsValidator"><code>s:commonsValidator</code></a>,
+ <a href="shale-core/tagreference-taglib.html#s:validatorVar"><code>s:validatorVar</code></a>,
+ and <a href="shale-core/tagreference-taglib.html#s:validatorScript"><code>s:validatorScript</code></a>. The
+ first two lets you attach a commons validator to a JSF input component and
+ the third generates JavaScript validation code for validating each JSF component
+ that has one or more Commons validators in a particular form. You can attach as
+ many Commons validators to a single JSF input component as you wish.</p>
+
+ </subsection>
+
+ <a name="validation-using"/>
+ <subsection name="Using Commons Validator Integration">
+
+ <p>Here's what you need to do to use Shale validation:</p>
+ <ul>
+ <li>
+ Add an <code>onsubmit</code> attribute to your <code>h:form</code> tag that calls
+ the JavaScript validation function generated by <code>s:validatorScript</code>.
+ </li>
+ <li>
+ Add Commons validators to JSF input components with <code>s:commonsValidator</code>
+ and, optionally, <code>s:validatorVar</code>.
+ </li>
+ <li>
+ Add an <code>s:validatorScript</code> tag at the end of the <code>h:form</code> tag's body.
+ </li>
+ </ul>
+
+ <p>Here's an example:</p>
+<source>
+<%@ taglib uri="http://shale.apache.org/core" prefix="s" %>
+...
+<h:form onsubmit="return validateForm(this);">
+
+ <h:inputText id="creditCardNumber"
+ size="16"
+ value="#{userContext.creditCardNumber}">
+
+ <s:commonsValidator type="required"
+ arg="#{msgs.creditCardNumberPrompt}"
+ server="true"
+ client="true"/>
+
+ <s:commonsValidator type="mask"
+ arg="#{msgs.creditCardNumberPrompt}"
+ server="true"
+ client="true">
+ <s:validatorVar name="mask" value="[4-6].*"/>
+ </s:commonsValidator>
+
+ <s:commonsValidator type="creditCard"
+ arg="#{msgs.creditCardNumberPrompt}"
+ server="true">
+ </h:inputText>
+
+ <h:message for="creditCardNumber" styleClass="errors"/>
+
+ <s:validatorScript functionName="validateForm"/>
+</h:form>
+...
+</source>
+ <p>In the preceding example, we've attached three Commons validators to a single
+ JSF input component. To pass validation, the field must have a value that
+ starts with a number between 4 and 6 inclusive and that value must be a valid
+ credit card number as verified by the <a href="http://en.wikipedia.org/wiki/Luhn_algorithm">Luhn</a> algorithm. Two of the
+ validations are performed on both client and server and one is performed
+ on the server only.</p>
+ <p><strong>Note:</strong> <i>At the present time, you have the option to forego
+ server-side validation, which is considered very bad practice. Users can turn off
+ JavaScript, so you should always backup client-side validation with server-side
+ validation. In the future, Shale may enforce server-side validation if it's
+ not explicitly specified.</i></p>
+ </subsection>
+
+ <a name="validation-custom"/>
+ <subsection name="Using Custom Validaton Rules">
+
+ <p>Shale's Commons Validator integration also allows you to use custom
+ validation rules.</p>
+
+ <p>In most cases, you will want to include the default rule set in
+ addition to your custom rules. In web.xml, use the
+ <code>org.apache.shale.validator.VALIDATOR_RULES</code> context
+ initialization parameter to specify a comma delimited list of files.</p>
+
+<source>
+ <!-- Shale Validator Configuration Resources -->
+ <context-param>
+ <param-name>org.apache.shale.validator.VALIDATOR_RULES</param-name>
+ <param-value>
+ /org/apache/shale/validator/validator-rules.xml,
+ /WEB-INF/custom-rules.xml
+ </param-value>
+ </context-param>
+</source>
+
+ <p>In this example, the default validator-rules.xml file will be loaded
+ from the shale-core.jar archive, and the custom-rules.xml file will be
+ loaded from WEB-INF.</p>
+
+ <p>To replace one of the provided rules,
+ place a modified copy of
+ <a href="http://svn.apache.org/repos/asf/shale/framework/trunk/shale-core/src/main/resources/org/apache/shale/validator/validator-rules.xml">validator-rules.xml</a>
+ in your webapp, and refer to it instead of the default file.</p>
+
+ <p>To add messages for your own validation rules, or to
+ customize the
+ <a href="http://svn.apache.org/repos/asf/shale/framework/trunk/shale-core/src/main/resources/org/apache/shale/validator/messages.properties">provided messages,</a>
+ configure a message bundle for your application in
+ /WEB-INF/faces-config.xml.</p>
+
+ <p>More information on Shale's Commons Validator integration, including
+ step-by-step examples, can be found on the
+ <a href="http://wiki.apache.org/shale/ShaleValidation">ShaleValidation</a>
+ Wiki page.</p>
+
+ </subsection>
+
+ </section>
+
+
+ </body>
+
+</document>
Propchange: shale/framework/trunk/shale-validator/src/site/xdoc/index.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: shale/framework/trunk/shale-validator/src/site/xdoc/index.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL