I think top doesn't need "#"(yeah I know I said "#top" ;) ). Either
"top.id" or just "id" should get you the id.

musachy

On Sun, Jan 25, 2009 at 4:02 PM, Wolfgang Knauf <his-metal...@freenet.de> wrote:
> Hi Musachy,
>
> Musachy Barroso wrote:
>>
>> Inside the action tag, the action will be on top of the stack, so you
>> can reference it using #top. The action is added to the context under
>> the "id" (2.0), or "var" (2.1) name, on the end of the tag, so you
>> cannot reference it by name inside the action tag. Wow, that was some
>> very confusing explanation in fact :)
>>
>
> What you say is clear to me, but I don't understand why the action does not
> seem to be placed on the value stack in the same way as any other action I
> call through a URL.
>
> I created a sample, you can find it here (jsp page and simple action with a
> property "id"):
> http://www.informatik.fh-wiesbaden.de/~knauf/private/struts2/Struts2Action.war
>
> To run it, call: http://localhost:8080/Struts2Action/index.jsp
> ==============
> This is the relevant part of my index.jsp:
> <s:action name="someaction" var="someActionVariable">
>  Inside s:action: Property "id": <s:property value="id"/> <br/>
>  Inside s:action: Property #someActionVariable.id:
>       <s:property value="#someActionVariable.id"/><br/>
>  Inside s:action: Property "#top.id": <s:property value="#top.id"/>
> </s:action>
> Property "id": <s:property value="id"/> <br/>
> Property #someActionVariable.id:
>  <s:property value="#someActionVariable.id"/><br/>
> Property "#top.id": <s:property value="#top.id"/> <br/>
>
> ==============
> The output is:
> Inside s:action: Property "id":
> Inside s:action: Property #someActionVariable.id:
> Inside s:action: Property "#top.id":
> Property "id":
> Property #someActionVariable.id: 10
> Property "#top.id":
> ==============
>
> I would expect the "<s:property value="id"/>" tag to find my "someaction" on
> the value stack and find it's "id" property.
>
> If I call the action directly
> (http://localhost:8080/Struts2Action/someaction.action), it works as
> expected. Only the "#top" expression seems to be wrong, probably my fault
> ;-).
>
> Thanks
>
> Wolfgang
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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

Reply via email to