Exception when s:optgroup list parameter is collection
------------------------------------------------------

                 Key: WW-2758
                 URL: https://issues.apache.org/struts/browse/WW-2758
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.1.2
            Reporter: Andreas Mähler


Hello S2 devs,

if I understand it right, the <s:optgroup> tag should behave like the normal 
<s:select> tag, but I can't pass a collection as list parameter.

Here's an Example:

{code:title=SomeAction.java|borderStyle=solid}
public class SomeAction extends ActionSupport
{
        public enum BasicType
        {
                ALL, TAG, OBJECT;
        }

        public List<BasicType> getBasicTypes()
        {
                return Arrays.asList( BasicType.values() );
        }
}
{code}

{code:xml|title=someresult.jsp|borderStyle=solid}

<%-- snip --%>

        <s:select name="type" size="1" list="basicTypes"> <%-- no problem here 
--%>
                <s:optgroup label="FooBar" list="basicTypes" /> <%-- boom! --%>
        </s:select>

<%-- snip --%>

{code}

This is the output:

{code:html|borderStyle=solid}
                                <select name="type" size="1" id="type">
    <option value="ALL">ALL</option>
    <option value="TAG">TAG</option>
    <option value="OBJECT">OBJECT</option>

<optgroup 
        label="FooBar"
>

<!-- FREEMARKER ERROR MESSAGE STARTS HERE --><script 
language=javascript>//"></script><script 
language=javascript>//'></script><script 
language=javascript>//"></script><script 
language=javascript>//'></script></title></xmp></script></noscript></style></object></head></pre></table></form></table></table></table></a></u></i></b><div
 align=left style='background-color:#FFFF00; color:#FF0000; display:block; 
border-top:double; padding:2pt; font-size:medium; font-family:Arial,sans-serif; 
font-style: normal; font-variant: normal; font-weight: normal; text-decoration: 
none; text-transform: none'><b style='font-size:medium'>FreeMarker template 
error!</b><pre><xmp>

No signature of method findValue matches the arguments
The problematic instruction:
----------
==> assignment: 
tmpKey=stack.findValue(optGroupInternalListUiBean.parameters.listKey) [on line 
38, column 9 in template/simple/optgroup.ftl]
 in include "/${parameters.templateDir}/simple/optgroup.ftl" [on line 88, 
column 1 in template/simple/select.ftl]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: No signature of method findValue 
matches the arguments
        at 
freemarker.ext.beans.MethodMap.getMemberAndArguments(MethodMap.java:94)
        at 
freemarker.ext.beans.OverloadedMethodModel.exec(OverloadedMethodModel.java:101)

. . . ...even more stacktrace here of course... .. .. .. . . .

{code}

Hope this really is a bug, but I  think so, because everything is fine with 
<s:select> and I could not find any restrictions in the reference docs.

Regards,
~Andreas

P.S: Why is the list attribute in <s:select> required? All my list elements can 
be found in nested <s:optgroup> tags and feeding <s:select> with an empty list 
is a little bit annoying.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to