This is my radio button code.
<s:radio name="filter" requiredposition="right"
list="#{'STATUS_FILTER_START':'START','STATUS_FILTER_END':'STOP'}"
value = "STATUS_FILTER_START"></s:radio>
or
<s:radio name="filter" requiredposition="right"
list="#{'STATUS_FILTER_START':'START','STATUS_FILTER_END':'STOP'}"
listValue = "STATUS_FILTER_START" listKey = "STATUS_FILTER_START"s></s:radio>
But nothing works.
Can somebody help me with this?
I dont want html:radio tag.
Set default value in your action class and use that in the OGNL to tell which value to select as default
List<String> filter= new ArrayList<String>();
filter.add("START");
filter.add("STOP");
public List<String> getFilter() {
return filter;
}
public String getDefaultFilterValue(){
return "STOP";
}
in your jsp use like
<s:radio label="filter" name="filter" list="filter" value="defaultGenderValue" />
i have used simple ArrayList but you are free to use Map.
Also for devs who are using static values. Here's the solution:
<s:radio label="correctOption" name="correctAnswer" list="
#{'1':'1','2':'2','3':'3','4':'4'}" value="1"/>
another one in case of strings in a static list:
<s:radio label="Gender" name="gender" list="
#{'male':'Male','female':'Female'}" value="'male'"/>
value
parameter.http://stackoverflow.com/questions/1110558/preselect-radio-button-in-struts - Umesh Awasthi 2012-04-04 05:44