alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Struts example source code file (validator-parser-test.xml)

This example Struts source code file (validator-parser-test.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Struts tags/keywords

cdata, cdata, doctype, doctype, group//xwork, opensymphony, public, some, validator, validator, you, you

The Struts validator-parser-test.xml source code

<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
    <field name="foo">
        <field-validator type="required">
            <message key="test.key">You must enter a value for foo.
        </field-validator>
    </field>
    <field name="bar">
        <field-validator type="required" short-circuit="true">
            <message key="bar.key">You must enter a value for bar.
        </field-validator>
        <field-validator type="int">
            <param name="min">6
            <param name="max">10
            <message>bar must be between ${min} and ${max}, current value is ${bar}.
        </field-validator>
        <field-validator type="regex">
            <param name="expression">
                <!-- Some useless comment for the following expression, which should be ignored by parser -->
                <![CDATA[([aAbBcCdD][123][eEfFgG][456])]]>
            </param>
            <message>bar must must match the given expression.
        </field-validator>
    </field>
    <validator type="expression">
        <param name="expression">email.equals(email2)
        <message>Email not the same as email2
    </validator>
    <validator type="expression" short-circuit="true">
        <param name="expression">email.startsWith('mark')
        <message>Email does not start with mark
    </validator>
</validators>

Other Struts examples (source code examples)

Here is a short list of links related to this Struts validator-parser-test.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.