Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Validation > url validator |

Apache Struts 2 Documentation
url validator
Edit Page Browse Space Add Page Add News
Added by tm_jee, last edited by Philip Luppens on Feb 10, 2007 (view change) show comment hide comment
Comment: Fixed macro url
View page history

# Description

URLValidator checks that a given field is a String and a valid URL

# Parameters

- fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required

# Examples

    <validators>
             <!-- Plain Validator Syntax -->
             <validator type="url">
                 <param name="fieldName">myHomePage</param>
                 <message>Invalid homepage url</message>
             </validator>

             <!-- Field Validator Syntax -->
             <field name="myHomepage">
                 <message>Invalid homepage url</message>
             </field>
        </validators>