You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Veluri, Naveen" <na...@tgslc.org> on 2002/01/10 16:55:06 UTC

Ragrding use of Radio Button

Hi,

 I was using struts 1.0 beta version for my application and I couldn't check
or select the radio button on my JSP
The radio button is a string in my form bean and I want to select that based
on checked or selected that I give for it.

If anyone can give me the syntax for using the tag(Just like HTML tag for
checked=true or something similar in struts version) 
in html <input type=radio value="XXX" checked> should work alright but I
wanted to know the similar syntax in case of struts for getting the radio
selected.
I do not want to initialize the value on the constructor for FormBean as
this value needs to come from my back-end database and I need to populate
this on JSP based on boolean value for one of my entity.

I would appreciate your help.

Thanks,
-Naveen. 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Ragrding use of Radio Button

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Naveen" == Naveen Veluri <Veluri> writes:

    Naveen> Hi,
    Naveen>  I was using struts 1.0 beta version for my application and I couldn't check
    Naveen> or select the radio button on my JSP
    Naveen> The radio button is a string in my form bean and I want to select that based
    Naveen> on checked or selected that I give for it.

    Naveen> If anyone can give me the syntax for using the tag(Just like HTML tag for
    Naveen> checked=true or something similar in struts version) 
    Naveen> in html <input type=radio value="XXX" checked> should work alright but I
    Naveen> wanted to know the similar syntax in case of struts for getting the radio
    Naveen> selected.
    Naveen> I do not want to initialize the value on the constructor for FormBean as
    Naveen> this value needs to come from my back-end database and I need to populate
    Naveen> this on JSP based on boolean value for one of my entity.

    Naveen> I would appreciate your help.

The "html:radio" component is essentially "rendered" from a property of a bean,
both of which you specify in the attributes of "html:radio" (the "name"
attribute specifies the bean, and the "property" attribute specifies the
property of the bean to use).

When the HTML component is generated, the RadioTag compares the value of your
"value" attribute with the current value of the bean property.  If they are
equal, it will insert the "checked=\"checked\"" string.

-- 
===================================================================
David M. Karr          ; Best Consulting
dmkarr@earthlink.net   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>