Below is a reply sent to this mailing list about the Tiles controller class.
The problem was trying to populate a dynamic Tiles attribute (exactly the same as what you want) in a cleaner way. If you still have problems post them in this thread and I will try to answer. Hope it helps, Pedro Salgado Hi Robert.. I guess you could achieve the same using the controllerClass attribute and building your class.. For instance, I have this definition in the tiles-defs.xml file: --- <definition name=".layout" path="/common/layout.jsp" controllerClass='com.dars.XTileAction'> <put name="title" value="Encabezado primario"/> <put name="leftside" value="/common/leftside.jsp"/> <put name="rightside" value="/common/rightside.jsp"/> <put name="header" value="/common/header.jsp"/> <put name="footer" value="/common/footer.jsp"/> <put name="body" value="/common/body.jsp"/> </definition> --- And I have this controllerClass --- package com.dars; import org.apache.struts.tiles.actions.TilesAction; import org.apache.struts.tiles.ComponentContext; import org.apache.struts.tiles.Controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletContext; import javax.servlet.ServletException; import java.io.IOException; public class XTileAction extends TilesAction implements Controller{ public void perform(ComponentContext tilesctx, HttpServletRequest request, HttpServletResponse response, ServletContext servctx) throws ServletException, IOException{ /* GetAttributes */ String titulo= (String)tilesctx.getAttribute("title"); String derecha= (String)tilesctx.getAttribute("rightside"); /* GetAttributes */ System.out.println(" Titulo: "+titulo); System.out.println(" Derecha: "+derecha); /* SetAttributes */ tilesctx.putAttribute("title", "Titulo nuevo de esta vaina.."); tilesctx.putAttribute("rightside", "/common/footer.jsp"); /* SetAttributes */ } } --- You can change the values of those attributes at runtime. I prefer to do it using this method. Atte. Domingo A. Rodriguez S. --- Robert Taylor <[EMAIL PROTECTED]> escribió: > Greetings, I have a tiles definition in my tiles-defs.xml similar to > below: > > <definition name="search" extends="layout"> > <put name="heading" value="{0}Search" type="string" /> > <put name="content" value="/search.jsp" type="page" /> > </definition> > > which I would like to be able to modify the "heading" value such that > at runtime I could substitute a value for {0}. > > For example, it would be ideal to use a JSTL type of syntax such as: > > <definition name="search" extends="layout"> > <put name="heading" value="${param.myValue}Search" type="string" /> > <put name="content" value="/search.jsp" type="page" /> > </definition> > > but this does not work. > > > > robert > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > _________________________________________________________ Do You Yahoo!? Información de Estados Unidos y América Latina, en Yahoo! Noticias. Visítanos en http://noticias.espanol.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] On 24/03/2004 18:14, "Mariano García González" <[EMAIL PROTECTED]> wrote: > > Hi all, > > I am newbie using tiles, so maybe this question is too easy for you. > > I want to use a tile definition in which, one of the attribute values is > dynamic. It is something like this: > > <definition name="tracebox.def.encoderconfig" extends="tracebox.def.menu"> > <put name="title" value="encoderconfig" /> > <put name="body" value="DYNAMIC CONTENT" /> > </definition> > > I want to use a dynamic url in body attribute, depending of a bean > attribute. > > I hope you understand me. Could you help me? > > Thanks, > Mariano. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] On 17/11/04 3:15 am, "Dave Bender" <[EMAIL PROTECTED]> wrote: > The logic:present looks like a good solution, but I would be interested in > seeing how you've defined a controllerClass to do the trick, too. > > Dave > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 16, 2004 2:29 PM > To: [EMAIL PROTECTED] > Subject: RE: Tiles:insert role(s)? > > > > You can also define a controllerClass for your tiles definition and > insert the tiles properties according to the user roles. > > If you need I can send you an example (tomorrow). > > Pedro Salgado > >> Hi Dave, >> You can use the logic present to show what you want for a particular >> role. You can use it like this : >> >> <logic:present role="admin,associates"> >> <tiles:insert page="left_nav/admin.jsp"/> >> </logic:present> >> >> With the logic:present you can write user as much that you want it. >> >> Charles >> >> -----Original Message----- >> From: Dave Bender [mailto:[EMAIL PROTECTED] >> Sent: November 16, 2004 2:07 PM >> To: Struts Users Mailing List >> Subject: Tiles:insert role(s)? >> >> >> Is it possible to make a tile show up for people from multiple roles? >> I'm building a dynamic menu and would like certain items to show up for >> people in different roles. For example: >> >> <tiles:insert page="left_nav/admin.jsp" role="admin" /> >> >> works great to make the admin link show up if the user in the 'admin' >> role. But I want some items to show up for a set of roles, so it'll >> appear if a user is in 'admin', 'associates', but not others. I've >> tried stringing together roles with commas, but that didn't work. Is >> there already a way to do this or do I need to write my own code? >> >> Thanks! >> >> Dave >> >> >> --------------------------------------------------------------------- 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]