You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Emil.I" <ia...@primus.ca> on 2008/03/23 21:41:35 UTC

Key property

Hello,
i iterate through a set and for 'key' i want to use the property of an
iterable element. eg:

<s:iterator value="job.skills" id="skill" status="status">
	<s:checkbox name="skillCode" key="?????"/>
</s:iterator>

skillCode is a string property of Skill object and i want it to be assigned
to skill property
of the s:checkbox tag. What is the syntax?



-- 
View this message in context: http://www.nabble.com/Key-property-tp16241092p16241092.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: Key property

Posted by st...@gmail.com.
I agree it's not real intuitive, but <s:iterator/> places its object on the
*top* of the value stack and it can be accessed via <s:property/>.

On Sun, Mar 23, 2008 at 3:41 PM, Emil.I <ia...@primus.ca> wrote:

>
> Hello,
> i iterate through a set and for 'key' i want to use the property of an
> iterable element. eg:
>
> <s:iterator value="job.skills" id="skill" status="status">
>        <s:checkbox name="skillCode" key="?????"/>
> </s:iterator>
>
> skillCode is a string property of Skill object and i want it to be
> assigned
> to skill property
> of the s:checkbox tag. What is the syntax?
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Key-property-tp16241092p16241092.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
>
>


-- 
Scott
stanlick@gmail.com

Re: key property of s:checkbox tag

Posted by Martin Gainty <mg...@hotmail.com>.
you can also use <s:checkboxlist
http://struts.apache.org/2.0.6/docs/checkboxlist.html
so in your case take myList and use it to set the list attribute as in this
example
<s:checkboxlist name="foo" list="myList"/>

M-
----- Original Message -----
From: "Kibo" <to...@gmail.com>
To: <us...@struts.apache.org>
Sent: Monday, March 24, 2008 2:38 PM
Subject: Re: key property of s:checkbox tag


>
> Hi
>
> I dont know whether I good understant, but the interface Set have not KEY.
> Supply the Set to List or Map.
>
> Then you can use:
> <s:iterator value="%{myList}">
> <s:checkbox label="value" name="key" value="true" />
>  </s:iterator>
>
> --------------------------------------------------------------------------
-----------------------------------
> Tomas Jurman
> Czech Republic
> --
> View this message in context:
http://www.nabble.com/key-property-of-s%3Acheckbox-tag-tp16241092p16259170.h
tml
> 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
>
>


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


Re: key property of s:checkbox tag

Posted by Kibo <to...@gmail.com>.
Hi

I dont know whether I good understant, but the interface Set have not KEY.
Supply the Set to List or Map.

Then you can use:
<s:iterator value="%{myList}">				  		
	<s:checkbox label="value" name="key" value="true" /> 							
 </s:iterator> 

-------------------------------------------------------------------------------------------------------------
Tomas Jurman
Czech Republic
-- 
View this message in context: http://www.nabble.com/key-property-of-s%3Acheckbox-tag-tp16241092p16259170.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: key property of s:checkbox tag

Posted by "Emil.I" <ia...@primus.ca>.
Ohh man
guess what i used %{property} for label element and everything is fine.



newton.dave wrote:
> 
> --- "Emil.I" <ia...@primus.ca> wrote:
>>   <s:checkbox name="skillCode" key="%{skillCode}"/>
>> 
>> skillCode being the property of object in a set whihc i iterate over,
>> doesn't work.
> 
> Try #skill.skillCode, if you're using "skill" as the ID of the iterated
> object.
> 
>> >>> <s:iterator value="job.skills" id="skill" status="status">
> 
> If it's a map IIRC the object pushed is a Map.Entry (allowing access by
> the
> "key" and "value" properties), if it's a set it's probably the object.
> 
> Maybe reposting the data structure contained in the set and the set
> declaration would be a good idea, though.
> 
> Dave
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/key-property-of-s%3Acheckbox-tag-tp16241092p16259720.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: key property of s:checkbox tag

Posted by Dave Newton <ne...@yahoo.com>.
--- "Emil.I" <ia...@primus.ca> wrote:
>   <s:checkbox name="skillCode" key="%{skillCode}"/>
> 
> skillCode being the property of object in a set whihc i iterate over,
> doesn't work.

Try #skill.skillCode, if you're using "skill" as the ID of the iterated
object.

> >>> <s:iterator value="job.skills" id="skill" status="status">

If it's a map IIRC the object pushed is a Map.Entry (allowing access by the
"key" and "value" properties), if it's a set it's probably the object.

Maybe reposting the data structure contained in the set and the set
declaration would be a good idea, though.

Dave



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


Re: key property of s:checkbox tag

Posted by "Emil.I" <ia...@primus.ca>.
If i put:

  <s:checkbox name="skillCode" key="%{skillCode}"/>

skillCode being the property of object in a set whihc i iterate over,
doesn't work.


Randy Burgess-3 wrote:
> 
> Have you tried this syntax?
> 
> <s:checkbox name="skillCode" key="%{propertyGoesHere}"/>
> 
> Regards,
> Randy Burgess
> Sr. Web Applications Developer
> Nuvox Communications
> 
> 
> 
>> From: "Emil.I" <ia...@primus.ca>
>> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
>> Date: Mon, 24 Mar 2008 10:23:07 -0700 (PDT)
>> To: <us...@struts.apache.org>
>> Subject: Re: key property of s:checkbox tag
>> 
>> 
>> So can i nest s:property within. Eg.:
>> 
>> <s:checkbox name="skillCode" key="<s:property/>"/>
>> 
>> the preceeding doesn't work. Is there anyway not including the solution,
>> where you put s:property tag beside s:checkbox, but actually setting the
>> key
>> property of
>> s:checkbox tag with skillCode?
>> 
>> 
>> Emil.I wrote:
>>> 
>>> Hello,
>>> i iterate through a set and for 'key' i want to use the property of an
>>> iterable element. eg:
>>> 
>>> <s:iterator value="job.skills" id="skill" status="status">
>>> <s:checkbox name="skillCode" key="?????"/>
>>> </s:iterator>
>>> 
>>> skillCode is a string property of Skill object and i want it to be
>>> assigned to skill property
>>> of the s:checkbox tag. What is the syntax?
>>> 
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> 
> http://www.nabble.com/key-property-of-s%3Acheckbox-tag-tp16241092p16256658.htm>
> l
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/key-property-of-s%3Acheckbox-tag-tp16241092p16257814.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: key property of s:checkbox tag

Posted by Randy Burgess <RB...@nuvox.com>.
Have you tried this syntax?

<s:checkbox name="skillCode" key="%{propertyGoesHere}"/>

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: "Emil.I" <ia...@primus.ca>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Mon, 24 Mar 2008 10:23:07 -0700 (PDT)
> To: <us...@struts.apache.org>
> Subject: Re: key property of s:checkbox tag
> 
> 
> So can i nest s:property within. Eg.:
> 
> <s:checkbox name="skillCode" key="<s:property/>"/>
> 
> the preceeding doesn't work. Is there anyway not including the solution,
> where you put s:property tag beside s:checkbox, but actually setting the key
> property of
> s:checkbox tag with skillCode?
> 
> 
> Emil.I wrote:
>> 
>> Hello,
>> i iterate through a set and for 'key' i want to use the property of an
>> iterable element. eg:
>> 
>> <s:iterator value="job.skills" id="skill" status="status">
>> <s:checkbox name="skillCode" key="?????"/>
>> </s:iterator>
>> 
>> skillCode is a string property of Skill object and i want it to be
>> assigned to skill property
>> of the s:checkbox tag. What is the syntax?
>> 
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> 
http://www.nabble.com/key-property-of-s%3Acheckbox-tag-tp16241092p16256658.htm>
l
> 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


Re: key property of s:checkbox tag

Posted by "Emil.I" <ia...@primus.ca>.
So can i nest s:property within. Eg.:

<s:checkbox name="skillCode" key="<s:property/>"/>

the preceeding doesn't work. Is there anyway not including the solution,
where you put s:property tag beside s:checkbox, but actually setting the key
property of
s:checkbox tag with skillCode?


Emil.I wrote:
> 
> Hello,
> i iterate through a set and for 'key' i want to use the property of an
> iterable element. eg:
> 
> <s:iterator value="job.skills" id="skill" status="status">
> 	<s:checkbox name="skillCode" key="?????"/>
> </s:iterator>
> 
> skillCode is a string property of Skill object and i want it to be
> assigned to skill property
> of the s:checkbox tag. What is the syntax?
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/key-property-of-s%3Acheckbox-tag-tp16241092p16256658.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