I just posted about this a few days ago... You should read section 4.1.1 of the Tiles Advanced Features (link at bottom of the page of the struts site, section on the Tiles User Guide) which gives examples like so:
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %> <tiles:definition id="definitionName" page="/layouts/myLayout.jsp" > <tiles:put name="title" value="Page Title" /> <tiles:put name="header" value="/tiles/header.jsp" /> <tiles:put name="footer" value="/tiles/footer.jsp" /> <tiles:put name="menu" value="/tiles/menu.jsp" /> <tiles:put name="body" value="/tiles/helloBody.jsp" /> </tiles:definition> I do something like that for my welcome.jsp index page. Regard,s David -----Original Message----- From: Kruse, Matt [mailto:[EMAIL PROTECTED] Sent: Monday, June 07, 2004 1:51 PM To: Struts Users Mailing List (E-mail) Subject: Tiles: Use layout definitions from config within jsp? I've always used tile definitions exclusively defined in tiles-defs.xml in the past. Now, I would like to have some pages where I put the <tiles:insert> commands directly into the JSP. However, I'd like to use my existing layout definitions from the config file rather than re-definiting them in the JSP or a JSP include file. For example: tiles-defs.xml -------------- <definition name="my.layout" path="/layouts/my_layout.jsp" extends="master.layout"> <put name="header" value="/tiles/header.jsp" /> <put name="content" value="" /> <put name="footer" value="/tiles/footer.jsp" /> </definition> in my jsp --------- <tiles:insert page="my.layout" flush="true"> <tiles:put name="content" type="String"> My content here </tiles:put> </tiles:insert> This would allow me to take advantage of my existing layout definitions and layering that I have setup, while allowing a few JSP pages to have more control over the content population. This way, I wouldn't have to :put the header, footer, etc every time because it would be defined by the layout or one of the parent layouts. Is this possible? (More explanation for those who are curious about the context...) ----------------------------------------------------------------- I'm converting an existing web application to use tiles. In some of the JSP pages, logic in the page decides to hide everything except for a table containing content (for printing, etc) - including all navigation and layout structure. So, I would like to use tiles:insert in the JSP itself, and switch which layout I use and which pieces get populated based on the logic within the JSP page itself. Also, a number of JSPs will need to populate about 4 or 5 separate tiles into the layout, and it's much easier to define the content in the JSP itself, rather than split it into 4 or 5 separate files to be included into the layout. For example: <tiles:insert page="my.layout" flush="true"> <tiles:put name="head" type="String"> Stuff that belongs in the <head> of the document, like meta tags </tiles:put> <tiles:put name="onload" type="String"> some javascript which should be inserted into the body's onload tag </tiles:put> <tiles:put name="content" type="String"> My content here </tiles:put> </tiles:insert> Make sense? Thanks, Matt Kruse --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]