You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paranoid_Fabio <pa...@yahoo.it> on 2008/02/28 18:17:45 UTC

Radio button with two boolean choices

Hello. I know it's really simple but I cannot make it works.
What I want to do is to put a radio button with two options, in a form. The
attribute that will be set by selecting one of the two options is a boolean.
That's it, simpy a true/false choice.
1) Is it possible to declare a static list directly in the JSP without the
callback to the action to get a Map with such boolean values?

2)If it is not possible, how can I do that. I tried to put a
Map<String,Boolean> called options in my Action 
and put that in the jsp:

<s:radio id="subChoice"  labelposition="top" key="ManualUploadForm.6"
name="c_sub"  list="options"></s:radio> 

where c_sub is a the boolean variable I want to set by choosing an option.
It does not work. 
In the log I get:

tag 'radio', field 'list', id 'subChoice', name 'c_sub': The requested list
key 'options' could not be resolved as a
collection/array/map/enumeration/iterator type. Example: people or
people.{name} - [unknown location]

Please help. Thano you very much.
-- 
View this message in context: http://www.nabble.com/Radio-button-with-two-boolean-choices-tp15741338p15741338.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Radio button with two boolean choices

Posted by Paranoid_Fabio <pa...@yahoo.it>.
ok.No matter. Thank you


Paranoid_Fabio wrote:
> 
> Hello. I know it's really simple but I cannot make it works.
> What I want to do is to put a radio button with two options, in a form.
> The attribute that will be set by selecting one of the two options is a
> boolean. That's it, simpy a true/false choice.
> 1) Is it possible to declare a static list directly in the JSP without the
> callback to the action to get a Map with such boolean values?
> 
> 2)If it is not possible, how can I do that. I tried to put a
> Map<String,Boolean> called options in my Action 
> and put that in the jsp:
> 
> <s:radio id="subChoice"  labelposition="top" key="ManualUploadForm.6"
> name="c_sub"  list="options"></s:radio> 
> 
> where c_sub is a the boolean variable I want to set by choosing an option.
> It does not work. 
> In the log I get:
> 
> tag 'radio', field 'list', id 'subChoice', name 'c_sub': The requested
> list key 'options' could not be resolved as a
> collection/array/map/enumeration/iterator type. Example: people or
> people.{name} - [unknown location]
> 
> Please help. Thano you very much.
> 

-- 
View this message in context: http://www.nabble.com/Radio-button-with-two-boolean-choices-tp15741338p15742181.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Radio button with two boolean choices

Posted by Dave Newton <ne...@yahoo.com>.
--- Paranoid_Fabio <pa...@yahoo.it> wrote:
> Now it's ok. Only a question... your advice works but the jsp editor says
> me: Syntax Error in EL. Do you know why?

Probably because the "#" character is used by other ELs and most JSP editors
don't parse OGNL as its own EL, let alone its anonymous list creation syntax.
Most likely it's attempting to parse it as JSF or UEL.

Dave


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


Re: Radio button with two boolean choices

Posted by Paranoid_Fabio <pa...@yahoo.it>.
Thank you very much. It works now. I tried it before, but instead of what you
suggested me I was trying with:

<s:radio list="#{1:'True', 0:'False'}" name="c_sub"/>    and it didn't work.

Now it's ok. Only a question... your advice works but the jsp editor says
me: Syntax Error in EL. Do you know why?

 <s:radio list="#{true:'True', false:'False'}" name="c_sub"/>   	

(the part in Bold is what the editor highlight as syntax error...)

Thank you


Paranoid_Fabio wrote:
> 
> Hello. I know it's really simple but I cannot make it works.
> What I want to do is to put a radio button with two options, in a form.
> The attribute that will be set by selecting one of the two options is a
> boolean. That's it, simpy a true/false choice.
> 1) Is it possible to declare a static list directly in the JSP without the
> callback to the action to get a Map with such boolean values?
> 
> 2)If it is not possible, how can I do that. I tried to put a
> Map<String,Boolean> called options in my Action 
> and put that in the jsp:
> 
> <s:radio id="subChoice"  labelposition="top" key="ManualUploadForm.6"
> name="c_sub"  list="options"></s:radio> 
> 
> where c_sub is a the boolean variable I want to set by choosing an option.
> It does not work. 
> In the log I get:
> 
> tag 'radio', field 'list', id 'subChoice', name 'c_sub': The requested
> list key 'options' could not be resolved as a
> collection/array/map/enumeration/iterator type. Example: people or
> people.{name} - [unknown location]
> 
> Please help. Thano you very much.
> 

-- 
View this message in context: http://www.nabble.com/Radio-button-with-two-boolean-choices-tp15741338p15741802.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Radio button with two boolean choices

Posted by Randy Burgess <RB...@nuvox.com>.
Yes it is. Have you tried something like this:
<s:radio list="#{true:'True', false:'False'}" name="yourFieldNameHere"/>?

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: Paranoid_Fabio <pa...@yahoo.it>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Thu, 28 Feb 2008 09:17:45 -0800 (PST)
> To: <us...@struts.apache.org>
> Subject: Radio button with two boolean choices
> 
> 
> Hello. I know it's really simple but I cannot make it works.
> What I want to do is to put a radio button with two options, in a form. The
> attribute that will be set by selecting one of the two options is a boolean.
> That's it, simpy a true/false choice.
> 1) Is it possible to declare a static list directly in the JSP without the
> callback to the action to get a Map with such boolean values?
> 
> 2)If it is not possible, how can I do that. I tried to put a
> Map<String,Boolean> called options in my Action
> and put that in the jsp:
> 
> <s:radio id="subChoice"  labelposition="top" key="ManualUploadForm.6"
> name="c_sub"  list="options"></s:radio>
> 
> where c_sub is a the boolean variable I want to set by choosing an option.
> It does not work.
> In the log I get:
> 
> tag 'radio', field 'list', id 'subChoice', name 'c_sub': The requested list
> key 'options' could not be resolved as a
> collection/array/map/enumeration/iterator type. Example: people or
> people.{name} - [unknown location]
> 
> Please help. Thano you very much.
> -- 
> View this message in context:
> http://www.nabble.com/Radio-button-with-two-boolean-choices-tp15741338p1574133
> 8.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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