aspose file tools*
The moose likes Struts and the fly likes struts 2 s:radio tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts 2 s:radio tag" Watch "struts 2 s:radio tag" New topic
Author

struts 2 s:radio tag

Bhaarat Sharma
Ranch Hand

Joined: Jun 04, 2007
Posts: 96
hello

I have the following code in one of my struts 2 source files.

then I am creating radio buttons like this

now i do see two radio buttons, 'Apples' and 'Oranges' on the screen but what If i want to put different values for the two? I believe listKey attribute is used for that purpose but what can i Pass here? I am lost!

for example what If i want a value of "1" for Apples and "2" or Oranges? should I be making a list, just like list for Apples and Oranges, and put values in that list?

thanks for any help


omnipresent
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

Use a HashMap instead of an ArrayList.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When all else fails, read the documentation. It states clearly what the listKey and listValue attributes do, and what will happen if you specify a Map for the list attribute.


Merrill
Consultant, Sima Solutions
Bhaarat Sharma
Ranch Hand

Joined: Jun 04, 2007
Posts: 96
thanks guys, that worked.

But I had another question. is it possible to change the font of the items displayed by the radio tag. Further, is it possible to change the row color on every iteration?

before struts, I had something like this

<TR bgColor=#ffffff scope="row">
-show radio button here--

...

<TR bgColor = "#eeeee" scope="row>
-show another radio button here--

but now since s:radio tag iterates on its own ..I only have one TR tag.
Bhaarat Sharma
Ranch Hand

Joined: Jun 04, 2007
Posts: 96
I was able to do this by modifying the radiomap.ftl template. works fine
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts 2 s:radio tag
 
Similar Threads
RadioButtons in Different Rows Struts 2
STruts 2 radio
struts2 list of radio buttons
Putting it together: Struts, Tags, OGNL
RadioButton with List Struts 2