As per the Tiles Definition file syntax
 In the tiles definition we can specify the role 
 (Role to be checked when definition will be inserted in a page.)
  
Similarly, It is possible to associate a role with tiles: put attribute.

I'm intending to allow the definition to be used based on the role.

The second scenario works fine for me.
I have my Login page for the application as stated below.

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert page="/WEB-INF/mainLayout.jsp" flush="true">
    <tiles:put name="title" value="Welcome Page"/>
    <tiles:put name="mainMenu" value="/adminMenupanel.jsp" role="admin"/>
    <tiles:put name="mainMenu" value="/mgrMenupanel.jsp" role="manager"/>
    <tiles:put name="mainMenu" value="/usrMenupanel.jsp" role="usr"/>
    <tiles:put name="mainHeader" value="/header.jsp"/>
    <tiles:put name="mainBody" value="/body.jsp"/>
    <tiles:put name="mainFooter" value="/footer.jsp"/>
</tiles:insert>

Depending upon the user's role, correct definition is inserted.

Now going on the same lines, when I have a definition with role specified, it  
doesn't seem to work. My tiles-definition is as follows.

<definition name="baseDef" path="/WEB-INF/mainLayout.jsp" >
    <put name="title" value="Tomcat Server" />
    <put name="header" value="/header.jsp"/>
    <put name="menu" value="/menupanel.jsp"/>
    <put name="tab" value=""/>
    <put name="body" value=""/>
</definition>

<definition name="Add" extends="baseDef" role="admin">
    <put name="tab" value="/WEB-INF/pages/tab.jsp"/>
    <put name="body" value="/WEB-INF/pages/body.jsp"/>
 </definition>

This definition (Add) gets applied for each of my role, though I was presuming that
only for the user with 'admin' role this definition will be executed.

What am I missing? Is it not a correct approach?
Kindly give some solution to achieve it.


Regards,
Ashutosh




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to