struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pilgrim, Peter" <peter.pilg...@csfb.com>
Subject RE: nested tiles:insert tags
Date Tue, 01 Jun 2004 09:08:00 GMT
Well the first thing I would suggest is that are you using a Struts Template
of Definition. I quick cursory glance looks like if you are just
using Tiles as a replacement for <jsp:include>. It looks messy.

<tiles:getAsString> does work very well. It returns a bean property just like 
a toString() method.


--
Peter Pilgrim
Operations/IT - Credit Suisse First Boston, 
10 South Colonnade, London E14 4QJ, United Kingdom
Tel: +44 (0)207 883 4447


> -----Original Message-----
> From: Colm Garvey [mailto:colm-garvey@letsys.com]
> Sent: 28 May 2004 12:04
> To: Struts Users Mailing List
> Subject: nested tiles:insert tags
> 
> 
> 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
> 

==============================================================================
This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.
==============================================================================


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


Mime
View raw message