Hi All,

I am using Struts 2.0.11 on RAD7, Webspher 6.1, JDK 1.5.

I am trying to create radio buttons using a dynamic Map as below:

<s:bean name="java.util.HashMap" id="keepRemoveRadioMap">
        <s:param name="Keep" value="john"/>
        <s:param name="Remove" value="doe"/>
</s:bean>


<td width="20%" style="background-color:#fffade; vertical-align:center">
        <s:radio name="keepRemove" list="keepRemoveRadioMap"  onclick=
"changeKeep1()" theme="simple"/>
</td>

But when I try to load the page, it is giving Freemaker Template exception
as below(I haven't pasted entire stack trace for readability) :
*
FreeMarker template error!*


Error on line 31, column 9 in template/simple/radiomap.ftl
stack.findString(parameters.listValue) is undefined.
It cannot be assigned to itemValue
The problematic instruction:
----------
==> assignment: itemValue=stack.findString(parameters.listValue) [on line
31, column 9 in template/simple/radiomap.ftl]
 in user-directive s.iterator [on line 23, column 1 in
template/simple/radiomap.ftl]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Error on line 31, column 9 in
template/simple/radiomap.ftl
stack.findString(parameters.listValue) is undefined.
It cannot be assigned to itemValue
        at freemarker.core.Assignment.accept(Assignment.java:111)
        at freemarker.core.Environment.visit(Environment.java:196)
        at freemarker.core.IfBlock.accept(IfBlock.java:82)
        at freemarker.core.Environment.visit(Environment.java:196)
        at freemarker.core.MixedContent.accept(MixedContent.java:92)
        at freemarker.core.Environment.visit(Environment.java:196)
        at freemarker.core.Environment.visit(Environment.java:233)
        at freemarker.core.UnifiedCall.accept(UnifiedCall.java:116)
        at freemarker.core.Environment.visit(Environment.java:196)
        at freemarker.core.MixedContent.accept(MixedContent.java:92)
        at freemarker.core.Environment.visit(Environment.java:196)
        at freemarker.core.Environment.process(Environment.java:176)
        at freemarker.template.Template.process(Template.java:232)
        at
org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:168)
        at
org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:530)
        at org.apache.struts2.components.UIBean.end(UIBean.java:484)
        at
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
        at
com.ibm._jsp._features_5F_form_5F_content._jspx_meth_s_radio_1(_features_5F_form_5F_content.java:1806)
        at
com.ibm._jsp._features_5F_form_5F_content._jspx_meth_s_if_12(_features_5F_form_5F_content.java:1847)
        at
com.ibm._jsp._features_5F_form_5F_content._jspx_meth_s_iterator_1(_features_5F_form_5F_content.java:1956)
        at
com.ibm._jsp._features_5F_form_5F_content._jspx_meth_s_if_2(_features_5F_form_5F_content.java:1994)
        at
com.ibm._jsp._features_5F_form_5F_content._jspx_meth_s_if_1(_features_5F_form_5F_content.java:2031)
        at
com.ibm._jsp._features_5F_form_5F_content._jspx_meth_s_iterator_0(_features_5F_form_5F_content.java:3493)
        at
com.ibm._jsp._features_5F_form_5F_content._jspService(_features_5F_form_5F_content.java:273)
        at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:85)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


But If I change the value for value attribute in <s:param> tag to '01' or
'02' or something then it works fine and display 1 and 2 instead of '01' and
'02' for label. So, is this some bug in <s:radio> in Struts2? What is the
solution if I want to dynamically create Map and assign it to list attribute
of <s:radio> ?

Thanks a lot in advance for the help one more time..

Reply via email to