Hi, I too have a doubt which is closely related to tiles role checking mechanism. I have defined the login page of my application like this. <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>
This works fine. Depending upon the user's role appropriate mainMenu is substituted. 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> Ideally this definition should have worked only for the role 'admin'. But if I copy paste the URL which leads to this definition for other roles it works as well. How can I ensure that a particular definition if meant for a role should not work in case of others? Thanks in advance. - Ashutosh -----Original Message----- From: Joe Hertz [mailto:[EMAIL PROTECTED] Sent: Monday, October 11, 2004 12:31 AM To: 'Struts Users Mailing List'; 'pradeeprao' Subject: RE: Where does Tiles check for roles for role based access Eh, You could use <tiles:insert attribute="menu" role="admin,module-admin" too. I guess maybe it's a better idea than I thought :-) -----Original Message----- From: Joe Hertz [mailto:[EMAIL PROTECTED] Sent: Sunday, October 10, 2004 2:36 PM To: 'Struts Users Mailing List'; 'pradeeprao' Subject: RE: Where does Tiles check for roles for role based access What I do in my "menu" tile would be something like this: <logic:present role="module-admin,admin"> <html:link blah blah blah>Administration</html:link> </logic:present> And the tile-defs for the screens that have the admin functions change what jsp gets used for the menu tile. Mixing and matching the jsps that get used in the layout, while layout is consistent, but the menu changes. This is basically what tiles were meant to be used for. Youre actually trying to make the layout sensitive to the role of the user... If you really want to replace the whole tile, you could "logic:present" around the <tiles:insert> tags. I wouldn't, but that's me. HTH, -Joe -----Original Message----- From: pradeeprao [mailto:[EMAIL PROTECTED] Sent: Sunday, October 10, 2004 9:46 AM To: [EMAIL PROTECTED] Subject: Where does Tiles check for roles for role based access Hai everyone! In my web app, i need to use Struts Tiles for role based access and deploy in JBoss as i also use EJBs for business tier. In my app., i have admin, user and module-admin. as roles. Based on the person logged in, i need to show him the extra links in the menu. If i have admin logged in and in tiles definition i use for an attribute role="admin", How come tiles know that admin has logged in, where does it check for those roles? Plz help me. I'm new to Struts and Tiles. ThankU -- Pradeep Rao Work Hard, Party Harder. ---- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]