You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Radoslav Krivak <rk...@gmail.com> on 2009/06/01 21:18:45 UTC

How to access variable in JSP tag scope from struts 2 tags (OGNL expression)

Hello,

how can I access variable that is defined inside the body of third party
(not struts2) tag? Example:

  <jmesa:struts2TableFacade    
      items="${users}"
      var="user">

      ${user.name}  <%-- works  --%>

      <s:iterator value="user.friends" var="friend"> <%-- doesn't work  --%>
          <s:property value="friend.name" />      
      </s:iterator>

  </jmesa:struts2TableFacade>


I know that JSP EL is forbidden in struts2 tags. But how could I access
variable "user" in example then? I haven't found anything about it in docs.
Please help me out, I'm completely lost here.
I use latest struts 2.1.7 (built from source).


RK
-- 
View this message in context: http://www.nabble.com/How-to-access-variable-in-JSP-tag-scope-from-struts-2-tags-%28OGNL-expression%29-tp23820238p23820238.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: How to access variable in JSP tag scope from struts 2 tags (OGNL expression)

Posted by Dave Newton <ne...@yahoo.com>.
rdk1 wrote:
> #request.user.friends doesn't work, nor #page.user.friends 

What are the possibilities you could provide a bit more context?

Dave

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


Re: How to access variable in JSP tag scope from struts 2 tags (OGNL expression)

Posted by Wes Wannemacher <we...@wantii.com>.
On Mon, Jun 1, 2009 at 4:54 PM, rdk1 <rk...@gmail.com> wrote:
>
> Wow! #attr.user.friends actually works! How esoteric...
>
>
>
> Anyway, thank you Wes
>
> RK
> --

No problem, explanations here -

http://struts.apache.org/2.x/docs/ognl.html
http://struts.apache.org/2.x/docs/ognl-basics.html


-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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


Re: How to access variable in JSP tag scope from struts 2 tags (OGNL expression)

Posted by rdk1 <rk...@gmail.com>.
Wow! #attr.user.friends actually works! How esoteric...



Anyway, thank you Wes

RK
-- 
View this message in context: http://www.nabble.com/How-to-access-variable-in-JSP-tag-scope-from-struts-2-tags-%28OGNL-expression%29-tp23820238p23822150.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: How to access variable in JSP tag scope from struts 2 tags (OGNL expression)

Posted by Wes Wannemacher <we...@wantii.com>.
Maybe - #attr.user.friends ?

I would assume that if ${user.name} works, then #attr should be able to find it.

-Wes

On Mon, Jun 1, 2009 at 4:23 PM, rdk1 <rk...@gmail.com> wrote:
>
> #request.user.friends doesn't work, nor #page.user.friends
>
> RK
> --
> View this message in context: http://www.nabble.com/How-to-access-variable-in-JSP-tag-scope-from-struts-2-tags-%28OGNL-expression%29-tp23820238p23821167.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
>
>



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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


Re: How to access variable in JSP tag scope from struts 2 tags (OGNL expression)

Posted by rdk1 <rk...@gmail.com>.
#request.user.friends doesn't work, nor #page.user.friends 

RK
-- 
View this message in context: http://www.nabble.com/How-to-access-variable-in-JSP-tag-scope-from-struts-2-tags-%28OGNL-expression%29-tp23820238p23821167.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: How to access variable in JSP tag scope from struts 2 tags (OGNL expression)

Posted by Wes Wannemacher <we...@wantii.com>.
Do you know which scope it is defined in?

I would try the following -

<s:iterator value="#request.user.friends" ...

-Wes

On Mon, Jun 1, 2009 at 3:18 PM, Radoslav Krivak <rk...@gmail.com> wrote:
>
> Hello,
>
> how can I access variable that is defined inside the body of third party
> (not struts2) tag? Example:
>
>  <jmesa:struts2TableFacade
>      items="${users}"
>      var="user">
>
>      ${user.name}  <%-- works  --%>
>
>      <s:iterator value="user.friends" var="friend"> <%-- doesn't work  --%>
>          <s:property value="friend.name" />
>      </s:iterator>
>
>  </jmesa:struts2TableFacade>
>
>
> I know that JSP EL is forbidden in struts2 tags. But how could I access
> variable "user" in example then? I haven't found anything about it in docs.
> Please help me out, I'm completely lost here.
> I use latest struts 2.1.7 (built from source).
>
>
> RK
> --
> View this message in context: http://www.nabble.com/How-to-access-variable-in-JSP-tag-scope-from-struts-2-tags-%28OGNL-expression%29-tp23820238p23820238.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
>
>



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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