struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t t <wantt...@yahoo.com>
Subject RE: Checking radio button based on object value
Date Wed, 01 Dec 2004 19:14:41 GMT
To my opinion, using "true" and "false" as radio buttons' value is not a good idea. Try to
do that as shown in my example. If your form bean's scope is"session", there should be no
problem. it will reproduce what the user selected.
tong

Ciaran Hanley <ciaran.hanley@sentenial.ie> wrote:
optionOne, optionTwo are two groups consisting of two buttons each.
Basically each is an on and off switch, "true" or "false".

I can set the default values in my form bean ok, I set them all to false
initially. 

The problem is once updated options have been submitted and saved in the
session I need to reproduce the users choices the next time they visit the
same JSP.

So the next time into the JSP "true" and "false" values should be checked to
reflect the users options. I am trying to figure out how to do this

CH

-----Original Message-----
From: t t [mailto:wantte03@yahoo.com] 
Sent: 01 December 2004 18:39
To: Struts Users Mailing List
Subject: Re: Checking radio button based on object value

Not sure if your optionOne and optionTwo is two groups of radio button or
two radio button in one group. I give you an example to illustrate how to
set default values:

Suppose I have a group (group1) of radio buttons, say 3. I want to preselect
the first one.
In my JSP file. I do this:





In the form bean file, I will have a property called "group1", and default
value is "rb1"
private String group1="rb1";

Hope this helps.

Tong


Ciaran Hanley wrote:
Hi,



I have a form consisting of several radio buttons. Upon form generation I
need radio buttons in the form to be checked based on the attribute of a
bean stored in the session. If the beans property is true then a particular
radio button value of "true" should be checked.



Option One







Option Two







I want these preselected based on a bean which has variables corresponding
to each radio button



boolean optionOne = false;

boolean optionTwo = true;





How can I achieve this?

Thanks,

CH



---------------------------------
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today! 



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


		
---------------------------------
Do you Yahoo!?
 All your favorites on one personal page  Try My Yahoo!
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message