Brian Trzupek wrote:
I am using Struts 2 (tried 2.0.1-2.0.6) and am having bizarre behavior with the select tag in a jsp page.

My code looks like this:

 <s:form name="editCredential" action="step4">
        ....
<s:select list="credential.credentialGenerators" emptyOption="true" listKey="name" listValue="name"/>

<s:submit value="%{getText('credwizard.step3.submit')}" id="hider"/>
</s:form>

When I do this the list gets displayed with the fully qualified class name of the bean with the ID, instead of the name and description fields. (almost as if it can't find them)

I'm not sure what you mean; do you get a list of options where the rendered 'id' attribute is incorrect? the rendered value is incorrect? or just a single option element? What description fields? It would be helpful to include a sample of what you're seeing rendered vs. what you were expecting to see.

My current work around is to create the select by hand with:

<s:form name="editCredential" action="step4">
        ....
        <tr>
<td class="tdLabel"><label for="step4_credential_generator" class="label"><s:text name="credwizard.step3.generator"/></label></td>
            <td>
                <select name="credential.generator" id="step4_">
                    <s:iterator value="credential.credentialGenerators">
<option value="<s:property value="name"/>"><s:property value="name"/></option>
                    </s:iterator>
                </select>
            </td>
        </tr>
<s:submit value="%{getText('credwizard.step3.submit')}" id="hider"/>
</s:form>

--------------------

So my question is, why does the struts iterator tag perform the traversal of the list correctly and the struts select tag does not? Any advise on how to 'make it work' would be appreciated.

What type does the getCredentialGenerators() method return? And, assuming it's some sort of collection, what do the elements look like? I can't think of any reason off hand why the first code snippet would fail and the second work, but without seeing more of your code or understanding exactly *how* the first snippet fails, it's tough to diagnose.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to