You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Emi Lu <em...@encs.concordia.ca> on 2010/01/18 21:55:12 UTC

Struts2.1.8.1, s:push does not return s:property value

Good afternoon,

Struts2.1.8.1, the following push example
http://www.vaannila.com/struts-2/struts-2-example/struts-2-push-tag-example1.html

Title returns, but "s:push" never returns attributes such as "name" 
under artist. Does someone tries and knows the reason?


    <b>Album Title:     </b> <s:property value="title"  /> <BR/>
    <s:push value="artist" />
    <B>Artist Name:     </B> <s:property value="name"    /> <BR/>

Thanks a lot!
-- 
Lu Ying



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


Re: Struts2.1.8.1, s:push does not return s:property value

Posted by Emi Lu <em...@encs.concordia.ca>.
Musachy Barroso wrote:
> The pushed object will be on the stack while the tag is evaluated (in
> the tag body), and it will be popped after the end of the tag, so
> 
> <s:push value="%{'not now john'}">
>     <s:property value="%{top}"/>  <--- will print 'not now john'
> <s:push>
> 
> <s:property value="%{top}"/> <--will print whatever was in the top of
> the stack, before the "push" tag was invoked
> 
Sorry the example does shown within the push tag.
My mistake.

-- 
Lu Ying

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


Re: Struts2.1.8.1, s:push does not return s:property value

Posted by Emi Lu <em...@encs.concordia.ca>.
> The pushed object will be on the stack while the tag is evaluated (in
> the tag body), and it will be popped after the end of the tag, so
> 
> <s:push value="%{'not now john'}">
>     <s:property value="%{top}"/>  <--- will print 'not now john'
> <s:push>
> 
> <s:property value="%{top}"/> <--will print whatever was in the top of
> the stack, before the "push" tag was invoked

Thank you Musachy.

If I am right, the example in the tutorial does not work.

Working codes:
================
<s:push value="artist">
    Artist Name:<s:property value="name"    /> <BR/>
    Artist Bio: <s:property value="bio"     /> <BR/>
</s:push>



*Not* working codes shown in the link:
 >>http://www.vaannila.com/struts-2/struts-2-example/struts-2-push-tag-example1.html
====================================================
<s:push value="artist" />
Artist Name:<s:property value="name"    /> <BR/>
Artist Bio: <s:property value="bio"     /> <BR/>


Push an object, and then retrieve the object's attribute outside s:push 
tag will not work (have to use artist.name).

--
Lu Ying





> 
>> Struts2.1.8.1, the following push example
>> http://www.vaannila.com/struts-2/struts-2-example/struts-2-push-tag-example1.html
>>
>> Title returns, but "s:push" never returns attributes such as "name" under
>> artist. Does someone tries and knows the reason?
>>   <b>Album Title:     </b> <s:property value="title"  /> <BR/>
>>   <s:push value="artist" />
>>   <B>Artist Name:     </B> <s:property value="name"    /> <BR/>

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


Re: Struts2.1.8.1, s:push does not return s:property value

Posted by Musachy Barroso <mu...@gmail.com>.
The pushed object will be on the stack while the tag is evaluated (in
the tag body), and it will be popped after the end of the tag, so

<s:push value="%{'not now john'}">
    <s:property value="%{top}"/>  <--- will print 'not now john'
<s:push>

<s:property value="%{top}"/> <--will print whatever was in the top of
the stack, before the "push" tag was invoked

musachy

On Mon, Jan 18, 2010 at 12:55 PM, Emi Lu <em...@encs.concordia.ca> wrote:
> Good afternoon,
>
> Struts2.1.8.1, the following push example
> http://www.vaannila.com/struts-2/struts-2-example/struts-2-push-tag-example1.html
>
> Title returns, but "s:push" never returns attributes such as "name" under
> artist. Does someone tries and knows the reason?
>
>
>   <b>Album Title:     </b> <s:property value="title"  /> <BR/>
>   <s:push value="artist" />
>   <B>Artist Name:     </B> <s:property value="name"    /> <BR/>
>
> Thanks a lot!
> --
> Lu Ying
>
>
>
> ---------------------------------------------------------------------
> 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