You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ralf Lorenz <ra...@subsist.de> on 2002/08/09 16:42:35 UTC

Tiles-ComponentContext - understanding problem

Hi,
again a question about Tiles.

My problem is about choosing the correct menu for the user, which can be of
one of four user-groups. Therefore I defined 4 different menus.
When the user successfully logs in he/she is forwarded to inside.jsp which
only consists of one line :

<tiles:insert definition="ZuKS.mainLayoutDefinition" flush="true"
controllerClass="de.subsist.zeiterfassung.controller.MenuInitController"/>

Then the MenuInitController chooses the right definition and places the
'title' and the 'menuitems' - List in the
given ComponentContext and the 'menu'-Element (menu.jsp) should get this
attributes into page context but it doesn't. This is the error message:

[ServletException in:/secureZone/layout/menu.jsp] Cannot find bean menuItems
in scope null'

    or

[ServletException in:/secureZone/layout/menu.jsp] Error - tag
importAttribute : property 'title' not found in context. Check tag syntax'

when I import with this statement : <tiles:importAttribute name="title"
scope="page"/>

As I want the menu to be chosen just once (just after the login succeeded) I
thought it's best to place the controller at the first entry point of the
user.
But it seems that this is not working!

Any help or suggestions would be good for my headache ...
Ralf


<!-- main layout description  -->

 <definition name="ZuKS.mainLayoutDefinition"
path="/secureZone/layout/mainLayout.jsp">
   <put name="title"  value="Zeiterfassungs- und KontierungsSystem - ZuKS -"
/>
   <put name="header" value="/secureZone/common/header.jsp" />
   <put name="logout" value="/secureZone/common/logout.jsp" />
   <put name="body"   value="/secureZone/common/body.jsp" />
   <put name="menu"   value="/secureZone/layout/menu.jsp" />
   <put name="language" value="/secureZone/common/language.jsp" />
   <put name="footer" value="/secureZone/common/footer.jsp" />
  </definition>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tiles-ComponentContext - understanding problem

Posted by Cedric Dumoulin <ce...@apache.org>.
  Hi,

  Your inside.jsp page insert your main definition after setting title 
and menuItems attributes. These attributes are available to the  current 
tiles context,  which is here "ZuKS.mainLayoutDefinition". It is why you 
don't find them in menu.jsp (tiles attributes are local to the tiles, 
they can't be accessed by parent or inserted tiles).
  What you can do is to explicitly pass your attribute in your layout, 
or specify an appropriate definition as attribute "menu".

   Hope this help,

         Cedric

Ralf Lorenz wrote:

>Hi,
>again a question about Tiles.
>
>My problem is about choosing the correct menu for the user, which can be of
>one of four user-groups. Therefore I defined 4 different menus.
>When the user successfully logs in he/she is forwarded to inside.jsp which
>only consists of one line :
>
><tiles:insert definition="ZuKS.mainLayoutDefinition" flush="true"
>controllerClass="de.subsist.zeiterfassung.controller.MenuInitController"/>
>
>Then the MenuInitController chooses the right definition and places the
>'title' and the 'menuitems' - List in the
>given ComponentContext and the 'menu'-Element (menu.jsp) should get this
>attributes into page context but it doesn't. This is the error message:
>
>[ServletException in:/secureZone/layout/menu.jsp] Cannot find bean menuItems
>in scope null'
>
>    or
>
>[ServletException in:/secureZone/layout/menu.jsp] Error - tag
>importAttribute : property 'title' not found in context. Check tag syntax'
>
>when I import with this statement : <tiles:importAttribute name="title"
>scope="page"/>
>
>As I want the menu to be chosen just once (just after the login succeeded) I
>thought it's best to place the controller at the first entry point of the
>user.
>But it seems that this is not working!
>
>Any help or suggestions would be good for my headache ...
>Ralf
>
>
><!-- main layout description  -->
>
> <definition name="ZuKS.mainLayoutDefinition"
>path="/secureZone/layout/mainLayout.jsp">
>   <put name="title"  value="Zeiterfassungs- und KontierungsSystem - ZuKS -"
>/>
>   <put name="header" value="/secureZone/common/header.jsp" />
>   <put name="logout" value="/secureZone/common/logout.jsp" />
>   <put name="body"   value="/secureZone/common/body.jsp" />
>   <put name="menu"   value="/secureZone/layout/menu.jsp" />
>   <put name="language" value="/secureZone/common/language.jsp" />
>   <put name="footer" value="/secureZone/common/footer.jsp" />
>  </definition>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>