If your keys are just numbers, perhaps you could use the Int Validator
<field-validator type="int">
<param name="min">0</param>
<message key="required.country"></message>
</field-validator>
http://struts.apache.org/2.x/docs/int-validator.html
Otherwise I'd try some variations of the expression. It's operating on
the getUser().getCountry() property of your action so the expression
(user.country == '-1') must be valid for its type.
Raghuveer Rawat wrote:
Hi, I need help for mandatory field validation for s:select.
I am trying to do client side xml validation.
jsp code for country list:
<s:select name="user.country" headerKey="-1" headerValue="Select Country"
list="countryList" listKey="code"
listValue="name" required="true" />
I tried with below validation code but it is not working.. Not sure what
will be other approach..
<field name="user.country">
<field-validator type="fieldexpression">
<param name="expression"><![CDATA[user.country ==
'-1']]></param>
<message key="required.country"></message>
</field-validator>
</field>
Thanks a lot...
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.19.21/1267 - Release Date: 8/02/2008 8:12 PM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]