I have a very specific issue that I just can't find the right answer to. It's driving me crazy!!
I have a situation where I need to build a list of options for a user to select from. In my design I think it best to do this with a radio button group. So I have generated a table with one column showing the radio button and other columns containing information about that selection. I have been able to sucessfully generate that table and radio button. However, I am having problems giving the <s:radio> function the proper value for each instance of the button.
I think my question is really about data handling in Struts 2, because I have been able to get the tag to work. I just can't get the right information to the tag.
I spent the weekend researching this and discovered many different suggestions and have tried most of them. Nothing has changed the result.
No matter what option I try I get the following error:
| Quote: |
tag 'radio', field 'list', name 'masterKey': The requested list key '#{${current.id}:''}' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
|
Here is the latest version of the code in my jsp:
| Code: |
<c:forEach items="${wizmstBean.wizdtlList}" var="current" varStatus="i">
<tr class="${rowclass}">
<td nowrap="nowrap" class="tabletd" align="center">
${current.id}
<s:radio theme="simple" name="detailKey" list="#{1:''}"/>
</td>
<td nowrap="nowrap" class="tabletd">
${ current.adminProjClassTbl.name }
</td>
<td nowrap="nowrap" class="tabletd">
${current.adminProjTypeTbl.name}
</td>
<td nowrap="nowrap" class="tabletd">
${current.adminIndustryTypeTbl.name}
</td>
</tr>
</c:forEach>
|
This code displays the page just fine other than my problem with the radio button.
Notice what I have put in the list parameter of the s:radio function. Because of the
I am getting 1 as the value of every radio button. I need to get the proper value in that option. Notice also that I have
${current.id} beside the radio button. This currently displays a value beside the radio button. This is the value that I want to use for the radio button. I have researched for hours, hours and more hours. I have tried both "c:forEach" and "s:iterator". I can't get this to work!!!
I know the answer will be embarasingly simple but I need to replace the list paramater with something that will use current.id as the radio value. I have tried NUMEROUS variations based on what I have encountered on the 'net. All of which results in the error shown above. This includes:
| Code: |
list="#{current.id:''}"
list="#{#current.id:''}"
list="#{${current.id}:''}"
list="#{current.{id}:''}"
|
What is the code I must use in the list parameter so that the value of current.id is the value of the radio button?
Please!! Help me with this. How do I change the list parm to make this work?