You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pankaj Gupta <pa...@gmail.com> on 2007/11/14 06:12:20 UTC

How to preselect a radio button in Struts 2

Hi,
I am working on Struts 2 and I want to preselect  a radio button.
If somebody can let me know how to go about it.
Regards,
Pankaj

Fwd: How to preselect a radio button in Struts 2

Posted by Pankaj Gupta <pa...@gmail.com>.
Hey,
I tried it  out
  <tr>
 <td class="tccValueField">    <s:radio label="Courtesy Call Requested"
name="courtesyCallFlag" list="#{'Yes':'Yes','No':'No'}" listKey="#{'No'}"
listValue="No"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   </td>
   </tr>

But it didn't worked.
I tried
<s:radio list="#{1:'Yes', 2:'No'}" value="${u.access_lvl_types_id}"
> name="users(${u_rowNum})
.access_lvl_types_id"/>
But this was also of not much  help. Sic eit didn't selected a  radio button
by default

I want by default a value of radio button to be pre selected when a jsp page
comes up.
If somebody has a solution to it.

Regards,
Pankaj










On Nov 15, 2000 8:40 PM, <mgainty@hotmail.com > wrote:

> the classic example sets a Map on VS referencable via var
> <s:action name="GenderMap" var="genders"/>
> and then obtains its list of genders by getGenders() from GenderMap
> and sets the default selection will be determined (in this case) by the
> getMale()
> <s:radio label="Gender" name="male" list="#genders.genders"/>
>
> so in your case
> <s:action name="listMap" var="list"/>
> where the name is the name of the element and
> the value getList is the the iterable source to populate the list from
> and sets the default selection will be determined (in this case) by the
> getId()
> <s:radio label="list" name="id" list="#list.list"/>
>
> http://struts.apache.org/2.0.11/docs/radio.html
> M--
> ----- Original Message -----
> Wrom: IPBARHDMNNSKVFVWRKJVZCMHVIBGDADRZFSQ
> To: "Struts Users Mailing List" <user@struts.apache.org >
> Sent: Thursday, November 15, 2007 9:01 AM
> Subject: Re: How to preselect a radio button in Struts 2
>
>
> > Here is a working example.
> >
> > <s:radio list="#{1:'Yes', 2:'No'}" value="${ u.access_lvl_types_id}"
> > name="users(${u_rowNum}).access_lvl_types_id"/>
> >
> > The value coming from the bean is always 1 or 2.
> >
> > HTH
> >
> > Regards,
> > Randy Burgess
> > Web Applications Developer
> > Nuvox Communications
> >
> >
> >
> > > Wrom: HYUCDDJBLVLMHAALPTCXLYRWTQTIPWIGYOKSTT
> > > Reply-To: Struts Users Mailing List < user@struts.apache.org>
> > > Date: Thu, 15 Nov 2007 11:53:53 +0530
> > > To: Struts Users Mailing List <user@struts.apache.org >
> > > Subject: Re: How to preselect a radio button in Struts 2
> > >
> > > Hi,
> > > I tried the same. But it didn't worked
> > > <s:radio label="Courtesy Call  Requested" name="courtesyCallFlag"
> > > list="{'Yes','No'}" value="No" required="true" />
> > > Regards,
> > > Pankaj
> > >
> > >
> > > On 11/14/07, Randy Burgess < RBurgess@nuvox.com> wrote:
> > >>
> > >> Use the value attribute and the radio button with that value will be
> > >> selected.
> > >>
> > >> <s:radio name="r1" value="<some ognl value>" list="<some ognl
> list/map>"/>
> > >>
> > >> Regards,
> > >> Randy Burgess
> > >> Web Applications Developer
> > >> Nuvox Communications
> > >>
> > >>
> > >>
> > >>> Wrom: ZRCLBDXRQBGJSNBOHMKHJYFMYXOEAIJJPHSCRT
> > >>> Reply-To: Struts Users Mailing List < user@struts.apache.org>
> > >>> Date: Wed, 14 Nov 2007 10:42:20 +0530
> > >>> To: <us...@struts.apache.org>
> > >>> Subject: How to preselect a radio button in Struts 2
> > >>>
> > >>> Hi,
> > >>> I am working on Struts 2 and I want to preselect  a radio button.
> > >>> If somebody can let me know how to go about it.
> > >>> Regards,
> > >>> Pankaj
> > >>
> > >>
> > >>
> > >> This email and any attachments ("Message") may contain legally
> privileged
> > >> and/or confidential information.  If you are not the addressee, or if
>
> this
> > >> Message has been addressed to you in error, you are not authorized to
> read,
> > >> copy, or distribute it, and we ask that you please delete it
> (including
> all
> > >> copies) and notify the sender by return email.  Delivery of this
> Message to
> > >> any person other than the intended recipient(s) shall not be deemed a
> waiver
> > >> of confidentiality and/or a privilege.
> > >>
> > >> ---------------------------------------------------------------------
>
> > >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >> For additional commands, e-mail: user-help@struts.apache.org
> > >>
> > >>
> >
> >
> >
> > This email and any attachments ("Message") may contain legally
> privileged
> and/or confidential information.  If you are not the addressee, or if this
>
> Message has been addressed to you in error, you are not authorized to
> read,
> copy, or distribute it, and we ask that you please delete it (including
> all
> copies) and notify the sender by return email.  Delivery of this Message
> to
> any person other than the intended recipient(s) shall not be deemed a
> waiver
> of confidentiality and/or a privilege.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>

Re: How to preselect a radio button in Struts 2

Posted by Pankaj Gupta <pa...@gmail.com>.
Hey,
I tried it  out
  <tr>
 <td class="tccValueField">    <s:radio label="Courtesy Call Requested"
name="courtesyCallFlag" list="#{'Yes':'Yes','No':'No'}" listKey="#{'No'}"
listValue="No"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   </td>
   </tr>

But it didn't worked.
I tried
<s:radio list="#{1:'Yes', 2:'No'}" value="${u.access_lvl_types_id}"
> name="users(${u_rowNum}).access_lvl_types_id"/>
But this was also of not much  help. Sic eit didn't selected a  radio button
by default

I want by default a value of radio button to be pre selected when a jsp page
comes up.
If somebody has a working solution to it.

Regards,
Pankaj









On Nov 15, 2000 8:40 PM, <mg...@hotmail.com> wrote:

> the classic example sets a Map on VS referencable via var
> <s:action name="GenderMap" var="genders"/>
> and then obtains its list of genders by getGenders() from GenderMap
> and sets the default selection will be determined (in this case) by the
> getMale()
> <s:radio label="Gender" name="male" list="#genders.genders"/>
>
> so in your case
> <s:action name="listMap" var="list"/>
> where the name is the name of the element and
> the value getList is the the iterable source to populate the list from
> and sets the default selection will be determined (in this case) by the
> getId()
> <s:radio label="list" name="id" list="#list.list"/>
>
> http://struts.apache.org/2.0.11/docs/radio.html
> M--
> ----- Original Message -----
> Wrom: IPBARHDMNNSKVFVWRKJVZCMHVIBGDADRZFSQ
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Thursday, November 15, 2007 9:01 AM
> Subject: Re: How to preselect a radio button in Struts 2
>
>
> > Here is a working example.
> >
> > <s:radio list="#{1:'Yes', 2:'No'}" value="${u.access_lvl_types_id}"
> > name="users(${u_rowNum}).access_lvl_types_id"/>
> >
> > The value coming from the bean is always 1 or 2.
> >
> > HTH
> >
> > Regards,
> > Randy Burgess
> > Web Applications Developer
> > Nuvox Communications
> >
> >
> >
> > > Wrom: HYUCDDJBLVLMHAALPTCXLYRWTQTIPWIGYOKSTT
> > > Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> > > Date: Thu, 15 Nov 2007 11:53:53 +0530
> > > To: Struts Users Mailing List <us...@struts.apache.org>
> > > Subject: Re: How to preselect a radio button in Struts 2
> > >
> > > Hi,
> > > I tried the same. But it didn't worked
> > > <s:radio label="Courtesy Call  Requested" name="courtesyCallFlag"
> > > list="{'Yes','No'}" value="No" required="true" />
> > > Regards,
> > > Pankaj
> > >
> > >
> > > On 11/14/07, Randy Burgess <RB...@nuvox.com> wrote:
> > >>
> > >> Use the value attribute and the radio button with that value will be
> > >> selected.
> > >>
> > >> <s:radio name="r1" value="<some ognl value>" list="<some ognl
> list/map>"/>
> > >>
> > >> Regards,
> > >> Randy Burgess
> > >> Web Applications Developer
> > >> Nuvox Communications
> > >>
> > >>
> > >>
> > >>> Wrom: ZRCLBDXRQBGJSNBOHMKHJYFMYXOEAIJJPHSCRT
> > >>> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> > >>> Date: Wed, 14 Nov 2007 10:42:20 +0530
> > >>> To: <us...@struts.apache.org>
> > >>> Subject: How to preselect a radio button in Struts 2
> > >>>
> > >>> Hi,
> > >>> I am working on Struts 2 and I want to preselect  a radio button.
> > >>> If somebody can let me know how to go about it.
> > >>> Regards,
> > >>> Pankaj
> > >>
> > >>
> > >>
> > >> This email and any attachments ("Message") may contain legally
> privileged
> > >> and/or confidential information.  If you are not the addressee, or if
> this
> > >> Message has been addressed to you in error, you are not authorized to
> read,
> > >> copy, or distribute it, and we ask that you please delete it
> (including
> all
> > >> copies) and notify the sender by return email.  Delivery of this
> Message to
> > >> any person other than the intended recipient(s) shall not be deemed a
> waiver
> > >> of confidentiality and/or a privilege.
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >> For additional commands, e-mail: user-help@struts.apache.org
> > >>
> > >>
> >
> >
> >
> > This email and any attachments ("Message") may contain legally
> privileged
> and/or confidential information.  If you are not the addressee, or if this
> Message has been addressed to you in error, you are not authorized to
> read,
> copy, or distribute it, and we ask that you please delete it (including
> all
> copies) and notify the sender by return email.  Delivery of this Message
> to
> any person other than the intended recipient(s) shall not be deemed a
> waiver
> of confidentiality and/or a privilege.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>

Re: How to preselect a radio button in Struts 2

Posted by Randy Burgess <RB...@nuvox.com>.
Here is a working example.

<s:radio list="#{1:'Yes', 2:'No'}" value="${u.access_lvl_types_id}"
name="users(${u_rowNum}).access_lvl_types_id"/>

The value coming from the bean is always 1 or 2.

HTH

Regards,
Randy Burgess
Web Applications Developer
Nuvox Communications



> From: Pankaj Gupta <pa...@gmail.com>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Thu, 15 Nov 2007 11:53:53 +0530
> To: Struts Users Mailing List <us...@struts.apache.org>
> Subject: Re: How to preselect a radio button in Struts 2
> 
> Hi,
> I tried the same. But it didn't worked
> <s:radio label="Courtesy Call  Requested" name="courtesyCallFlag"
> list="{'Yes','No'}" value="No" required="true" />
> Regards,
> Pankaj
> 
> 
> On 11/14/07, Randy Burgess <RB...@nuvox.com> wrote:
>> 
>> Use the value attribute and the radio button with that value will be
>> selected.
>> 
>> <s:radio name="r1" value="<some ognl value>" list="<some ognl list/map>"/>
>> 
>> Regards,
>> Randy Burgess
>> Web Applications Developer
>> Nuvox Communications
>> 
>> 
>> 
>>> From: Pankaj Gupta <pa...@gmail.com>
>>> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
>>> Date: Wed, 14 Nov 2007 10:42:20 +0530
>>> To: <us...@struts.apache.org>
>>> Subject: How to preselect a radio button in Struts 2
>>> 
>>> Hi,
>>> I am working on Struts 2 and I want to preselect  a radio button.
>>> If somebody can let me know how to go about it.
>>> Regards,
>>> Pankaj
>> 
>> 
>> 
>> This email and any attachments ("Message") may contain legally privileged
>> and/or confidential information.  If you are not the addressee, or if this
>> Message has been addressed to you in error, you are not authorized to read,
>> copy, or distribute it, and we ask that you please delete it (including all
>> copies) and notify the sender by return email.  Delivery of this Message to
>> any person other than the intended recipient(s) shall not be deemed a waiver
>> of confidentiality and/or a privilege.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 



This email and any attachments ("Message") may contain legally privileged and/or confidential information.  If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email.  Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to preselect a radio button in Struts 2

Posted by Pankaj Gupta <pa...@gmail.com>.
Hi,
I tried the same. But it didn't worked
<s:radio label="Courtesy Call  Requested" name="courtesyCallFlag"
list="{'Yes','No'}" value="No" required="true" />
Regards,
Pankaj


On 11/14/07, Randy Burgess <RB...@nuvox.com> wrote:
>
> Use the value attribute and the radio button with that value will be
> selected.
>
> <s:radio name="r1" value="<some ognl value>" list="<some ognl list/map>"/>
>
> Regards,
> Randy Burgess
> Web Applications Developer
> Nuvox Communications
>
>
>
> > From: Pankaj Gupta <pa...@gmail.com>
> > Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> > Date: Wed, 14 Nov 2007 10:42:20 +0530
> > To: <us...@struts.apache.org>
> > Subject: How to preselect a radio button in Struts 2
> >
> > Hi,
> > I am working on Struts 2 and I want to preselect  a radio button.
> > If somebody can let me know how to go about it.
> > Regards,
> > Pankaj
>
>
>
> This email and any attachments ("Message") may contain legally privileged
> and/or confidential information.  If you are not the addressee, or if this
> Message has been addressed to you in error, you are not authorized to read,
> copy, or distribute it, and we ask that you please delete it (including all
> copies) and notify the sender by return email.  Delivery of this Message to
> any person other than the intended recipient(s) shall not be deemed a waiver
> of confidentiality and/or a privilege.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: How to preselect a radio button in Struts 2

Posted by Randy Burgess <RB...@nuvox.com>.
Use the value attribute and the radio button with that value will be
selected.

<s:radio name="r1" value="<some ognl value>" list="<some ognl list/map>"/>

Regards,
Randy Burgess
Web Applications Developer
Nuvox Communications



> From: Pankaj Gupta <pa...@gmail.com>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Wed, 14 Nov 2007 10:42:20 +0530
> To: <us...@struts.apache.org>
> Subject: How to preselect a radio button in Struts 2
> 
> Hi,
> I am working on Struts 2 and I want to preselect  a radio button.
> If somebody can let me know how to go about it.
> Regards,
> Pankaj



This email and any attachments ("Message") may contain legally privileged and/or confidential information.  If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email.  Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org