1) Solution using JSP Change
Here value of x is 1 or 2 or 3 or 4. Instead of "This is Option x"
<s:radio label="YourQuestion" name="yourAnswer" list="#{'1':' This is Option 1','2':' This is Option 2','3':' This is Option 3','4':' This is Option 4'}" value="1" />
value attribute will set the default value. list will contain the radio button values.
2) EDIT: Another Solution Using Java
For Dynamic Options create something like this
public class RadioOptions{
private String key;
private String value;
//getter and setter methods
}
Here you can retrieve the calls using the key value.
List<RadioOptions> radioOption= new ArrayList<RadioOptions>();
radioOption.add( new RadioOptions("1", "This is option 1.") );
radioOption.add( new RadioOptions("2", "This is option 2.") );
radioOption.add( new RadioOptions("3", "This is option 3.") );
radioOption.add( new RadioOptions("4", "This is option 4.") );
Your HTML Tag look like this.
<s:radio label="Please select the best choice" name="answer" list="radioOption"
listKey="key" listValue="value" value="1" />