How do I set default selected value in Struts2 <s:select> tag?

Ganesamoorthy picture Ganesamoorthy · Sep 20, 2010 · Viewed 44k times · Source

I am new in Struts2. I have user form, role column have a drop-down list. When user form is in edit mode, the stored values are placed into corresponding controls. But I can't set drop-down list by default selected value. How can I do it?

Answer

Robyn P picture Robyn P · Oct 17, 2011

In addition to Nate's answer, I've found that I need to put apostrophes around the data in the value attribute if the key type is a String in order for it to recognize that my input value is a String.