I am using struts2 and jsp as development envionment. I have a select tag on my jsp wherein i need to , 1. Make a default selection depending on my bean/action class's property value. if the property is 1 then i need to select Yes and if its 0 then i need to display No to the user. 2. Also when the form is submitted i need to pass the value in revese way to the bean i.e if selected is Yes pass 1 else 0. i am able to do the 2nd one but not the first, i.e getting the default selection and displaying it. does anybody know how to do it?
Just call an action that forwards to this JSP, and in that action, declare a property with the same name as the name used in the s:select tag and set it to 0 or 1. This will automatically cause the correct value to be selected when the JSP is displayed.