File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes initialize html:radio Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "initialize html:radio" Watch "initialize html:radio" New topic

initialize html:radio

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 104


I would like to initialize a html:radio

I have a bean called FAQ wich has a boolean property called bandera so I would like to select one botton for default accordind to bandera property I also would like to disable the radio button if bandera is true.

Is it possible?

<html:radio property ="estado" value ="1" disabled="<c utvalue='${FAQ.bandera}'/>" /><span class="txt001">Validado
<html:radio property ="estado" value ="2" disabled="<c ut value='${FAQ.bandera}'/>" />
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can't embed one custom tag inside another, so the code you've shown us won't work. However, if you use the struts-el version of the tags, you can simply substitute an EL expression in a tag attribute. Example:

Just make sure you have the struts-el.jar file in your WEB-INF/lib directory.

Regarding how to set the default value, simply have your action class set the value of the estado property before the page is displayed. For example, if you want the first button to be checked by default, put the following in the action class that forwards to this JSP:

[ May 10, 2007: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
I agree. Here's the link:
subject: initialize html:radio
It's not a secret anymore!