tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lee Theobald <...@openobjects.com>
Subject [Tiles 2 Standalone] Where are my JSTL/EL variables?
Date Tue, 22 Jan 2008 15:39:26 GMT

HI all,

I'm having a look at Tiles and I'm having a few problems getting it to work
with my JSTL.  Could somebody take a look at the following code and let me
know if I'm doing anything wrong.  I'm using Tiles on it's own with plain
JSPs some core tag libraries.  Here's my code:

Template
&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %&gt;
&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %&gt;
&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %&gt;

&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"
/&gt;
&lt;title&gt;&lt;tiles:getAsString name="pageTitle"
ignore="true"/&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="pagewrap"&gt;
	&lt;div id="header"&gt;
		&lt;tiles:insertAttribute name="header" /&gt;
	&lt;/div&gt;
	&lt;div id="main"&gt;
		&lt;tiles:insertAttribute name="main" /&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


Header
&lt;h1&gt;HEADER&lt;/h1&gt;
&lt;c:set var="test" value="Wibble"/&gt;
&lt;p&gt;Test = &lt;c:out value="${test}"/&gt;&lt;/p&gt;
&lt;h3&gt;Params&lt;/h3&gt;
&lt;dl id="requestvars" style="display:none;"&gt;
	&lt;c:forEach var='parameter' items='${paramValues}'&gt;
	  &lt;dt&gt;${parameter.key}&lt;/dt&gt;
	  &lt;c:choose&gt;
		&lt;c:when test="${empty parameter.value[0]}"&gt;
		  &lt;dd&gt;&nbsp;&lt;/dd&gt;
		&lt;/c:when&gt;
		&lt;c:otherwise&gt;
		  &lt;dd&gt;${parameter.value[0]}&lt;/dd&gt;
		&lt;/c:otherwise&gt;
	  &lt;/c:choose&gt;
	&lt;/c:forEach&gt;
&lt;/dl&gt;


Index.jsp
&lt;%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%&gt;

&lt;tiles:insertTemplate template="templates/template.jsp"&gt;
	&lt;tiles:putAttribute name="pageTitle" value="Hello world!" /&gt;
	&lt;tiles:putAttribute name="header" type="template"
value="../includes/header.jspf" /&gt;
	&lt;tiles:putAttribute name="main" type="template"
value="../includes/main.jspf" /&gt;
&lt;/tiles:insertTemplate&gt;


I'm wondering if I am declaring my taglibs in the right place.  I've tried
putting them in all three pages though and it doesn't help.  Also if it
helps, I have tiles initialised/defined as a startup servlet in my web.xml.

-- 
View this message in context: http://www.nabble.com/-Tiles-2-Standalone--Where-are-my-JSTL-EL-variables--tp15021180p15021180.html
Sent from the tiles users mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message