This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes Other approach to pre-select radio button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Other approach to pre-select radio button" Watch "Other approach to pre-select radio button" New topic
Author

Other approach to pre-select radio button

Jazzy Sanchez
Ranch Hand

Joined: Apr 02, 2006
Posts: 35
I've been searching on how to pre-select a radio button using struts tags, and so far, the only way is to define its value on its action form.

Is there other way to do it?
How about if I am going to use DynaValidatorForm?

Thanks!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
As long as you set the property value prior to the point at which the JSP code is run, you can do it anywhere you like.

- In the Action class that forwards to the JSP.
Example: myForm.setRadioValue("xyz");
DynaForm Example: dynaForm.set("radioValue", "xyz");
- in the JSP itself
Example <c:set target="myForm" property="radioValue" value="xyz" />
DynaForm Example: <c:set target="myForm.map" property="radioValue" value="xyz" />
[ June 21, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Other approach to pre-select radio button
 
Similar Threads
set radio button value in jsp using javascript?
Disable the radio button from radio button
RADIO BUTTON WITH ROW IN DATA TABLE
print database values with radio button
deselecting radio button