struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <mark.l...@boxstuff.com>
Subject Re: nested tiles:insert tags
Date Sat, 29 May 2004 17:27:01 GMT

<tiles:useAttribute id="title" name="pageTitle" scope="request" />

<c:out value="${title}" />

or

<jsp:getProperty name="title" />

or

<bean:write name="title" />

This will work in inserted tiles as the variable is scoped to the 
request rather than page.

On 28 May 2004, at 13:03, Colm Garvey wrote:

> Has anyone been able to nest tiles such that <tiles:getAsString,,>
> placeholders in the topmost frame can be populated by another tile 2 
> levels
> down?
>
> For example, I have a base.jsp tile (which is used by all my pages) 
> which is
> responsible for color, global scripts etc..
> I would like to set up a generic search.jsp tile for use in search 
> pages as
> well as a generic list.jsp tile which could contain my datagrid 
> controls.
>
> So the page structure looks like this
>
>  widgetSearchResults.jsp inserts listTile.jsp which in turn inserts
> baseTile.jsp
>
> baseTile.jsp sets up most of the page structure, including the page 
> title,
> like so: <tiles:getAsString name="pageTitle"/>
> but I want to declare the pageTitle on my widgetsearchresults.jsp page.
>
> I've tried nesting <tiles:getAsString> tags within <tiles:put> tags 
> but I'm
> getting an error thrown back at me. (see sample code)
>
> Here's some sample code:
>
> baseTile.jsp
>
> ---------------------------------------- START
>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"
> %><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"
> %><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"
> %><%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"
> %><%@ page contentType="text/html; charset=utf-8" language="java"
> import="java.sql.*" errorPage="/error.jsp" %>
> <html:html locale="true">
> <head>
> <html:base />
> <title><tiles:getAsString name="title"/></title>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> <link href="/eRespond/media/css/base.css" rel="stylesheet" 
> type="text/css">
> <!-- Page Specific Styles-->
> <tiles:getAsString name="css" ignore="true"/
> <!-- Page Specific Javascript -->
> <script language="javascript" src="/eRespond/media/js/common.js"
> type="text/javascript"></script>
> <tiles:getAsString name="javascript" ignore="true"/>
> </head>
> <body <tiles:getAsString name="bodyParams" ignore="true"/> >
> <tiles:get name="toolbar" ignore="true"/>
> <tiles:getAsString name="bodyContent" ignore="true"/>
> <!-- Miscellaneous footer content -->
> <tiles:getAsString name="footer" ignore="true"/>
> <tiles:insert page="/tiles/commonFooter.jsp" />
> </body>
> </html:html>
> ---------------------------------------- END
>
>
>
> listTile.jsp
> ---------------------------------------- START
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"
> %><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"
> %><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"
> %><%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"
> %><%@ page contentType="text/html; charset=UTF-8" language="java"
> import="java.sql.*" errorPage="/error.jsp" %>
> <tiles:insert page="/tiles/baseTile.jsp">
>  <tiles:put name="title" type="String">
>   <tiles:getAsString name="TITLE"/><!-- THIS DOESN'T WORK BUT LEAVING 
> IT OUT
> DOESN'T WORK EITHER -->
> </tiles:put>
>
> <tiles:put name="css">
> <LINK href="/eRespond/media/css/listTile.css" type="text/css"
> rel=StyleSheet>
>     <tiles:getAsString name="CSS"/>
> </tiles:put>
> <tiles:put name="javascript">
> <script language="javascript" src="/eRespond/media/js/listTile.js"
> type="text/javascript"></script>
>     <tiles:getAsString name="JAVASCRIPT"/>
> </tiles:put>
>
> <tiles:put name="bodyParams"> <tiles:getAsString 
> name="BODYPARAMS"/><!--
> </tiles:put>
>
> <tiles:put name="bodyContent">
>
>
> HTML goes here for the setup of the list control
>
>  <tiles:getAsString name="PAGECONTENT"/>
>
> more HTML goes here
>
> </tiles:put>
> </tiles:insert>
> ---------------------------------------- END
>
>
>
> widgetSearchResults.jsp
> ---------------------------------------- START
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"
> %><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"
> %><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"
> %><%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"
> %><%@ page contentType="text/html; charset=UTF-8" language="java"
> import="java.sql.*" errorPage="/error.jsp" %>
> <tiles:insert page="/tiles/listTile.jsp">
> <tiles:put name="TITLE" type="String">
>     <bean:message key="events.title.eventsearchresults"/>
> </tiles:put>
>
>
> <tiles:put name="CSS">
>         page specific CSS goes here
> </tiles:put>
> <tiles:put name="JAVASCRIPT">
>         Page Specific Javascript goes here
> </tiles:put>
>
> <tiles:put name="bodyParams"> onLoad="doOnLoads();" 
> onResize="setHeights();"
> unselectable="false" </tiles:put>
>
> <tiles:put name="PAGECONTENT">
>     HTML and my logic:iterate tags go here to display the resultset
> </tiles:put>
> </tiles:insert>
> ---------------------------------------- END
>
> Anyone able to tell me how I can make the above work?
>
> Thanks for taking an interest,
>
> Colm
>


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


Mime
View raw message