Java
  Home arrow Java arrow Page 3 - Validator
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Validator
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 22
    2005-09-22

    Table of Contents:
  • Validator
  • Validator Overview
  • Included Validations
  • Creating Form Beans
  • Configuring validation.xml
  • Enabling Client-Side Validations
  • Adding a New Validation Rule
  • Internationalizing Validations
  • Create a validation.xml File

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Validator - Included Validations


    (Page 3 of 9 )

    By default, Validator comes packaged with several basic validation routines that you can use to solve most validation scenarios. As mentioned, the sample applications provided by Struts come packaged with preconfigured validator-rules.xml files that define these routines. Table 6-1 lists each of the preconfigured validations by logical name and states its purpose.


    Note  Detailed information on configuring the validator-rules.xml file is found in Chapter 18.

     

     

    Validation

    Description

    byte

    Validates that the specified field contains a valid byte.

    creditCard

    Validates that the specified field contains a valid credit card number.

    date

    Validates that the specified field contains a valid date.

    double

    Validates that the specified field contains a valid double.

    email

    Validates that the specified field contains a valid e-mail address.

    float

    Validates that the specified field contains a valid float.

    floatRange

    Validates that the specified field contains a valid float and falls within the

     

    specified range.

    integer

    Validates that the specified field contains a valid integer.

    intRange

    Validates that the specified field contains a valid integer and falls within the

     

    specified range.

    long

    Validates that the specified field contains a valid long.

    TABLE 6-1  Validator’s Preconfigured Validations

     

     

    Validation

    Description

    mask

    Validates that the specified field conforms to a given regular expression (or "mask").

    maxlength

    Validates that the string in the specified field’s length is less than or equal to the

     

    specified maximum length.

    minlength

    Validates that the string in the specified field’s length is greater than or equal to

     

    the specified minimum length.

    range

    Deprecated

     

    Use the intRange validation instead.

    required

    Validates that the specified field contains characters other than white space

     

    (i.e., space, tab, and newline characters).

    requiredif

    Performs the required validation on the specified field if a specified rule is met.

    short

    Validates that the specified field contains a valid short.

    TABLE 6-1   Validator’s Preconfigured Validations (continued)

    More Java Articles
    More By McGraw-Hill/Osborne


     

    Buy this book now. This article is taken from chapter six of the book The Complete Reference Struts, written by James Holmes (McGraw-Hill/Osborne, 2004; ISBN: 0072231319). Check it out at your favorite bookstore. Buy this book now.

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek