Hi,

thank you for your reply.
Taking your comments I ended with the following jsp code:

<s:form>
<s:iterator value="results">
        <s:property value="id" /><br />
        <s:property value="value" /><br />
        <s:property value="method" /><br />
        <s:property value="doc.title" /><br />
        <s:radio list="{1, 2, 3, 4, 5}" name="currentResult.rating" />
</s:iterator>
<s:submit />
</s:form>

Having for example two datasets in results, I can only select one radio button (because the name has no dynamic component in the name). I tried something like name="rating[%{id}]" but I fail to get these parameters set in my Action class.

com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression 'rating[1]' with value '[Ljava.lang.String;@6ae7c6d1' ognl.OgnlException: target is null for setProperty(null, "1", [Ljava.lang.String;@6ae7c6d1)

How do the set-methods for this have to look like?

I'd prefer having a HashMap<Integer, Integer> with the key set by the id from the result and the value from the radio button.

Mario

Am 23.04.10 16:10, schrieb Martin Gainty:
<s:radio list="availableLevels" name="currentEmployee.level"/>

Date: Fri, 23 Apr 2010 15:55:52 -0700
From: ma...@lipinski.tk
To: user@struts.apache.org
Subject: Dynamic list of radio buttons

Hello,

I am wondering how to create a dynamic form containing a set of radio
buttons.

So I have an iterable list of database results. Any of the results
should be rated using radio buttons.

When the form is submitted I want to have a hashmap with an id as the
key and the value selected with the radio buttons as value.

How can I achieve this using struts2 and jsp?


Mario

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to