How to validate struts2 select tag

Published on Author bloggerfiveLeave a comment

validator.xml
==========

<validators>

<field name=”city”>
<field-validator type=”fieldexpression”>
<param name=”expression”><![CDATA[(!(city == “-1″ ))]]></param>
<message>Please Select The City</message>
</field-validator>

</field>

</validators>

 

Jsp Page
======

<s:select
name=”city”
label=”Choose City”
list=”cityList”
listKey=”key”
listValue=”value”
headerKey=”-1″
headerValue=”Select” City/>

Comments

comments

Leave a Reply

Your email address will not be published. Required fields are marked *