| |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <link rel="stylesheet" href="../../../book.css" type="text/css"> |
| <title>Adding a Validator</title> |
| </head> |
| <body> |
| <div class="section" lang="en"> |
| <div class="titlepage"> |
| <div> |
| <div> |
| <h1 class="Head" style="clear: both"><a name="add_validator"></a>Adding |
| a Validator</h1> |
| </div> |
| </div> |
| <div></div> |
| </div> |
| <p>You can add a validator to your Web application. A validator |
| defines a set of standard classes for performing common data validation |
| checks, for example, a phone number input field must be numbers. A |
| component can have one or more validators.</p> |
| <p><span class="strong">To add a validator</span>:</p> |
| <div class="orderedlist"> |
| <ol type="1"> |
| <li> |
| <p>Select<span class="strong"> faces-config.xml</span> in the <span |
| class="strong">Project Explorer</span> of the <span class="strong">J2EE</span> perspective.</p> |
| <p>The JSF Application Configuration editor opens.</p> |
| </li> |
| <li> |
| <p>Select the <span class="strong">Component </span>tab of the |
| editor.</p> |
| </li> |
| <li> |
| <p>Expand the <span class="strong">Validators</span> section.</p> |
| <p>A list of defined validators displays.</p> |
| </li> |
| <li> |
| <p>Click <span class="strong">Add</span>.</p> |
| <p>A new validator is added to the Converters list with the default |
| name New Validator<span class="emphasis"><em>x</em></span>.</p> |
| </li> |
| <li> |
| <p>(Optional) Change the default validator name to a unique, |
| descriptive name in the <span class="strong">Display name</span> field |
| of the <span class="strong">General </span>section.</p> |
| </li> |
| <li> |
| <p>(Optional) Type a description in the <span class="strong">Description</span> |
| field.</p> |
| </li> |
| <li> |
| <p>Type an ID in the <span class="strong">Validator ID</span> |
| field.</p> |
| </li> |
| <li> |
| <p>Click <span class="strong">Browse</span> and select a<span |
| class="strong"> Validator Class</span>.</p> |
| </li> |
| <li> |
| <p>Click <span class="strong">Add </span>in the <span |
| class="strong">Attributes </span>section to add an attribute value.</p> |
| </li> |
| <li> |
| <p>Click <span class="strong">Add </span>in the <span |
| class="strong">Properties </span>section to add a property.</p> |
| </li> |
| </ol> |
| </div> |
| <p></p> |
| <br> |
| <img src="../../../images/ngrelc.png" alt="Related concepts" border="0"> |
| <p><br> |
| </p> |
| |
| <p><img src="../../../images/ngrelr.png" alt="Related reference" |
| border="0"></p> |
| <p><br> |
| </p> |
| <p><a href="../use_facesconfig_editor.html">Faces Config |
| Editor</a><br> |
| </p> |
| |
| <p><img src="../../../images/ngrelt.png" alt="Related tasks" border="0"> |
| </p> |
| <p><a href="../../gettingstarted/tutorial/JSFTools_tutorial.html">Tutorial</a></p> |
| </div> |
| |
| </body> |
| </html> |