yeppe
yeppe

Reputation: 689

java - How to make Struts radio tag create a vertical list "The OGNL way"

This post has a reference to SO question"How to make Struts radio tag create a vertical list of radio buttons" only difference is that I don't want to use an iterator.

I just want to do like this.

radio button
* abc
* xyz

I am using struts tag code like this:

<s:radio id="testing"
list="#{'val1':'abc','val2':'xyz'}" />

Please note that I don't want to use a list like this to iterate through the list elements. I'd like to enter those values manually as above.. More or less i just want a tweak like "put a <br> element here and there" to just make the next radio button xyz come to the next line and not be attached to abc in the same line. Hope this explanation makes more clear the solution I'm looking at.

<s:iterator value="aList"> 
    <s:radio key="selectedId" list="{aObject}" listKey="id" listValue="name"/><br/> 
</s:iterator> 

Upvotes: 1

Views: 773

Answers (1)

yeppe
yeppe

Reputation: 689

I didn't know that ognl created map can be used to do this...

The Solution:

<s:iterator value="#{'val1':'abc','val2':'xyz'}" var="some"> 
    <s:radio key="selectedId" list="#some" listKey="key" listValue="value"/><br/>
</s:iterator >

Upvotes: 1

Related Questions