tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brian f <flanag...@gsicommerce.com>
Subject Newbie issue with insertAttribute
Date Tue, 15 Sep 2009 16:56:00 GMT

Hi all, brand new to templating in general and Tiles 2.  I've followed
through the tutorials on the Apache site and, after a bit of wrangling,
managed to get the Tiles lib working in Tomcat (version 6).  I'm stuck on
one last issue though: when I define an attribute inside of a definition
with a url string as the value, I can't seem to have it properly interpreted
during render to the page.  Instead of getting the contents of the url page,
I'm seeing the actual url string itself.

Here's my setup:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
		<definition name="myapp.homepage"
			<put-attribute name="banner" value="../tiles/pageTemplates/banner.jsp" />
			<put-attribute name="pageTitle" value="Tiles"/>
			<put-attribute name="bodyContent" value="body content"/>

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title><tiles:getAsString name="pageTitle"/></title>
	<tiles:insertAttribute name="banner"/><br />
	<tiles:getAsString name="bodyContent"/><br />
	<tiles:insertTemplate template="/tiles/pageTemplates/banner.jsp" />

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<tiles:insertDefinition name="myapp.homepage" />


When I load up tiles/index.jsp in my browser, here's what gets displayed:
body content

I had hoped that the <tiles:insertAttribute name="banner"/> line would
output the contents of banner.jsp, but instead it outputs the value of the
attribute (in this case, the url).  I'm not sure what I'm doing wrong here. 
If I use the insertTemplate, I get the properly interpreted file rendered
out to the page.  Am I missing something...?
View this message in context: http://www.nabble.com/Newbie-issue-with-insertAttribute-tp25457736p25457736.html
Sent from the tiles users mailing list archive at Nabble.com.

View raw message