struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashutosh Satyam" <ashut...@alopa.com>
Subject tiles-definition - role association issue
Date Thu, 07 Oct 2004 13:08:33 GMT
Hi,
 I know this is not a correct place to post this message.
 But I didn't get any response for this question in User Mailing list.
 Kindly provide me some inputs on my question.

Regards,
Ashutosh


============ Q U E S T I O N ===========================================


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 ( using tiles: put attribute) 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?







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


Mime
View raw message