You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@raibledesigns.com> on 2003/12/31 23:22:11 UTC

Serving up Tiles based on Role

I'd love to serve up a specific tile based on a role, but it doesn't
seem like it's currently possible in the Tiles Framework. Basically, I
want to do the following:

    <!-- User Profile definition -->
    <definition name=".userProfile" extends=".mainMenu">
        <put name="title.key" value="userProfile.title"/>
        <put name="heading.key" value="userProfile.heading"/>
        <put name="content" value="/WEB-INF/pages/userProfile.jsp"
role="admin"/>
        <put name="content" value="/WEB-INF/pages/userDetail.jsp"
role="tomcat"/>
    </definition>

In this example, users with role "admin" get the userProfile.jsp, while
users with a "tomcat" role get the userDetail.jsp.  Unfortunately,
"role" is not an allowed attribute on <put>.

It seems it's only possible to do this on a definition level - but then
they cannot be the same name, and it seems rather clunky.  For the
definition stuff, it'd be nice to do:

    <definition name=".userProfile" extends=".mainMenu">
        <put name="title.key" value="userProfile.title"/>
        <put name="heading.key" value="userProfile.heading"/>
        <put name="content" value=".meatOfPage"/>
    </definition>

    <definition name=".meatOfPage" path="/WEB-INF/pages/userProfile.jsp"
role="admin"/>
    <definition name=".meatOfPage" path="/WEB-INF/pages/userDetail.jsp"
role="tomcat"/>

Any tips are appreciated.

Matt



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


Re: Serving up Tiles based on Role

Posted by Tin Pham <tt...@learn.senecac.on.ca>.
Role based tiles is possible in the Tiles framework by putting your own
controller before the tile definition.

The pdf document,
http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf gives an
example of how to do this at Cedric Dumoulin's site,
http://www.lifl.fr/~dumoulin/tiles/


Happy New Year,

Tin


"Matt Raible" <ma...@raibledesigns.com> wrote in message
news:000501c3cfec$89156ca0$c700a8c0@raibledesigns.home...
> I'd love to serve up a specific tile based on a role, but it doesn't
> seem like it's currently possible in the Tiles Framework. Basically, I
> want to do the following:
>
>     <!-- User Profile definition -->
>     <definition name=".userProfile" extends=".mainMenu">
>         <put name="title.key" value="userProfile.title"/>
>         <put name="heading.key" value="userProfile.heading"/>
>         <put name="content" value="/WEB-INF/pages/userProfile.jsp"
> role="admin"/>
>         <put name="content" value="/WEB-INF/pages/userDetail.jsp"
> role="tomcat"/>
>     </definition>
>
> In this example, users with role "admin" get the userProfile.jsp, while
> users with a "tomcat" role get the userDetail.jsp.  Unfortunately,
> "role" is not an allowed attribute on <put>.
>
> It seems it's only possible to do this on a definition level - but then
> they cannot be the same name, and it seems rather clunky.  For the
> definition stuff, it'd be nice to do:
>
>     <definition name=".userProfile" extends=".mainMenu">
>         <put name="title.key" value="userProfile.title"/>
>         <put name="heading.key" value="userProfile.heading"/>
>         <put name="content" value=".meatOfPage"/>
>     </definition>
>
>     <definition name=".meatOfPage" path="/WEB-INF/pages/userProfile.jsp"
> role="admin"/>
>     <definition name=".meatOfPage" path="/WEB-INF/pages/userDetail.jsp"
> role="tomcat"/>
>
> Any tips are appreciated.
>
> Matt




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