the below code works to make the select option required. If nothing is selected 
displays the provided message.

<s:select name = "user.department" key = "user.department" headerKey="-1" 
             headerValue="-- Please Select --" list="allDepartments" 
required="true"
             requiredposition="left" /> 

In validation.xml

 <field name="user.department">
          <field-validator type="fieldexpression">
               <param name="expression">!(user.department).equals("1")</param>
               <message>Please select a department.</message>
         </field-validator> 
 </field> 

--
This message was sent on behalf of aruna....@gmail.com at openSubscriber.com
http://www.opensubscriber.com/message/user@struts.apache.org/10986643.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to