tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Baldes ...@open.ch>
Subject Tiles2 / Strus2 using an action's output as template
Date Tue, 12 Feb 2008 10:52:29 GMT

(Note: I have read some threads on this list about the same topic, but I 
found no answer. If I missed the right thread, I'm sorry. Furthermore, 
this might be a struts- and not a tiles question. I am not sure about that.)

I am trying to figure out how to do this the "right" way:

I have a struts action which returns a tile as a result. This tile has 
an attribute which points to another tile, which uses another action as 

    <definition name="layout" template="layout.jsp" >
      <put-attribute name="menu" value="menu" />

    <definition name="menu" template="/menu.action"  />

layout.jsp contains the line:

    <tiles:insertAttribute name="menu" />

At first I got the error message:

    The requested resource (/s2demo/menu.action) is not available

(This text was printed where the menu should have gone)
Somewhere on this list I found that I should add the struts filter 
dispatcher like this:


   (filter class name truncated for shortness)

After I did this, everything seemed fine at first - the menu rendered.

First question: is this the right way of doing that?

But then I started to use my function taglib. The tag library internally 
uses ServletActionContext.getRequest() for accessing the 
HttpServletRequest object.

As soon as layout.jsp contains <tiles:insertAttribute name="menu" />, 
ServletActionContext.getRequest() returns null in my taglib 
implementation, when called from layout.jsp like this:

    <tiles:insertAttribute name="menu" />

    <c:if test="${mylib:someThing()}" >...</c:if>

Without the insertAttribute call, the taglib works fine.

Can you help me with this?

Thanks in advance!

Daniel Baldes

View raw message