This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes using radio button in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "using radio button in struts" Watch "using radio button in struts" New topic

using radio button in struts

Amaninder Singh

Joined: May 13, 2008
Posts: 2
Hi all...
I trying to migrate an existing application to struts framework. In a particular jsp, we get some result records based on some particular criteria. All the records are in the form of text boxes so that we can edit the fields and make changed in database. After making changed to the text fields, we need to select a radio button to select the record which will be modified. The following is the code of jsp:-

< body>
< html:form action="/modify" method="post">
< table border="1">
< tr>
< th>Asset Id< /th>
< th>Asset Name< /th>
< th>Category< /th>
< th>Description< /th>
< /tr>
< logic:iterate name="records" id="record">
< tr>
< td>< html:text name="record" property="assetid" />< /td>
< td>< html:text name="record" property="assetname" />< /td>
< td>< html:text name="record" property="assetcategory" />< /td>
< td>< html:text name="record" property="description" />< /td>
< td>< input type="radio" name="select" value=< bean:write name="record" property="assetid"/>>< /input>< /td>

< /tr>
< /logic:iterate>
< /table>
< hr/>
< html:button value="Modify" property="modify_result" style="background-color:wheat" onklick="javascript:validate_form();"/>

< /html:form>
< /body>

Can anyone tell me the code to do the same thing using <html:radio>?

-- fixd < characters
[ May 13, 2008: Message edited by: Merrill Higginson ]
Amaninder Singh

Joined: May 13, 2008
Posts: 2
And I am sorry for all those irritating &it. I am new to Javaranch as well. So lack of experience. I was forced by an error message to replace all "<" with "&it" and the result is what you see above. Kindly help folks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If your Web application uses Servlet version 2.4 (check the DTD reference in web.xml) you can use an EL expression instead of a bean:write tag. Example:

Consultant, Sima Solutions
jQuery in Action, 2nd edition
subject: using radio button in struts
Similar Threads
Problem Passing Parameter values to action
Can't pass changed beans values from one JSP page to another
Problem in hiding the row of data
How to catch checkbox value
re:struts dynamic radio buttons