Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Validation > url validator
Added by tm_jee, last edited by Philip Luppens on Feb 10, 2007  (view change) show comment

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>