I've some problems with my select tags when validation fails.
For a registration, a user can select his birth city with a select tag. If the validation of the registration fails (empty or incorrect fields), i display the same jsp with errors messages.
In my case, when the validation fails, the list of cities contains only the selected element before the validation. And I don't understand why !!
My select is representing by a ArrayList in my action class (field 'ville') :
My registration jsp :
Note that I use the struts validation system with XML file ( <ClassAction>-<Aliasction>-validation.xml).
You have both the "list" and "value" attributes set to the same thing, so on return from validation the select's options will be set to the value of the action property. Normally the "list" contains the complete list of options and the "value" contains options for pre-selection.
And the selected value is set to 'civiliteSelected' ??
I try this case but it doesn't work... 'civiliteSelected' (and also 'civilites') has null value. (both the 'civiliteSelected' and the 'civilites' fields are declared as a String in my class name).
Note that i have correct getters and setters.
I think i don't understand very well the select's behavior...
I suspect you're doing something only minorly wrong; the JSP and action below work as expected (this uses the Convention plugin, but would be no different under standard config).
The pre-select value of civiliteSelected is reflected in the form, with the corresponding option element marked as selected, and civilites is set on form submission to the selected value. (Excuse any minor typos; did some manual editing.)