You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Antonio Petrelli <an...@gmail.com> on 2007/10/02 09:08:31 UTC

Re: active link highlighting with help of tiles

2007/10/2, Tuomo Sirén <tu...@tranceaddict.net>:
>
>  <s:if test="%{${active} == 'home'}">

I feel that this syntax is wrong, try:
<s:if test="%{active == 'home'}">

Antonio

Re: active link highlighting with help of tiles

Posted by Chris Pratt <th...@gmail.com>.
Can OGNL access things in the Page Scope?  You would probably have to
either use JSP EL

<s:if test="${active == 'home'}">

or import the attribute into the request scope and scope the OGNL EL

<tiles:importAttribute name="active" scope="request"/>
<s:if test="%{#request.active == 'home'}">

  (*Chris*)

Re: active link highlighting with help of tiles

Posted by TuomoS <tu...@tranceaddict.net>.
Sorry, I omitted too much information.

Struts 2.0.9, Tiles 2.0.4

the .main layout templage page has the following JSP code:

<tiles:importAttribute name="active" />

<div id="hor_nav">
    <tiles:insertAttribute name="hor_nav" />
</div>


And the "active" attribute is to be accessed from hor_nav.jsp. I changed the
importAttribute scope to request and it seems to be working now but not with
the struts if -tag, only with JSTL EL. Don't know why but this is fair
enough.

Many thanks for your help,

Best regards,
Tuomo




Antonio Petrelli-3 wrote:
> 
> Mmm... it's strange. I have a couple of questions to debug it:
> 1. versions of Tiles and Struts
> 2. please confirm my understanding that your JSP code resides in the
> template page of the ".main" definition
> 3. the attribute "active" will be created in page scope by default (if you
> don't specify the "scope" attribute). Try displaying it using JSTL or
> directly JSP EL.
> 
> Antonio
> 
> 

-- 
View this message in context: http://www.nabble.com/active-link-highlighting-with-help-of-tiles-tf4552986.html#a12995361
Sent from the tiles users mailing list archive at Nabble.com.


Re: active link highlighting with help of tiles

Posted by Antonio Petrelli <an...@gmail.com>.
2007/10/2, TuomoS <tu...@tranceaddict.net>:
>
>
> You are right about that, however the variable seems to be null.
>
> <s:if test="%{active == null}"> returns true.



Mmm... it's strange. I have a couple of questions to debug it:
1. versions of Tiles and Struts
2. please confirm my understanding that your JSP code resides in the
template page of the ".main" definition
3. the attribute "active" will be created in page scope by default (if you
don't specify the "scope" attribute). Try displaying it using JSTL or
directly JSP EL.

Antonio

Re: active link highlighting with help of tiles

Posted by TuomoS <tu...@tranceaddict.net>.
You are right about that, however the variable seems to be null.

<s:if test="%{active == null}"> returns true.


Tuomo



Antonio Petrelli-3 wrote:
> 
> 2007/10/2, Tuomo Sirén <tu...@tranceaddict.net>:
>>
>>  <s:if test="%{${active} == 'home'}">
> 
> I feel that this syntax is wrong, try:
> <s:if test="%{active == 'home'}">
> 
> Antonio
> 
> 

-- 
View this message in context: http://www.nabble.com/active-link-highlighting-with-help-of-tiles-tf4552986.html#a12994412
Sent from the tiles users mailing list archive at Nabble.com.