It's not a secret anymore!
The moose likes Struts and the fly likes Struts2 DisplayTag Radio Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 DisplayTag Radio" Watch "Struts2 DisplayTag Radio" New topic

Struts2 DisplayTag Radio

sam jsem

Joined: Mar 12, 2011
Posts: 9
I have noticed some confusion regarding how to create a single radio button using Strut (2.2.1) and deploying it in a DisplayTag (1.2) table. I was able to figure out one solution, so I thought I may take the time to share my results. Hopefully I am doing it the recommended way; if not: Please advise as to the recommend approach.

I have implemented the PaginatedList interface packaged with Displaytag. I save the implementation of the PaginatedList interface in session after I have populated the java.util.List implementation from my datasource. In my JSP, I use the following code to render one radio button that is associated with one row in an HTML table rendered by Displaytag:

This will display the following rows of HTML (using a little imagination): Assuming that the '*' is the radio button; and 'Wilson' refers to the 'fname' column.

* | Cuddy
* | Baar
* | Khan
* | Parmar

Here is the partial HTML source for the radio button:

<td><input type="radio" name="ckey" id="ckey" value="206059"/><label for="id"> </label></td>

Hope this helps someone out there.
I agree. Here's the link:
subject: Struts2 DisplayTag Radio
jQuery in Action, 3rd edition