You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by bj...@dommel.be on 2008/10/10 10:25:03 UTC
Problem with JSTL, c:set
I have a rather annoying issue, which I can't get around for some reason. We're
using Spring MVC, together with Tiles 2 in our project. So far, we didn't have
any issues. We configured the template, added a header and footer and
everything was fine.
The problem is when we try to add the c:set-tag to one of our tiles. When we do
this, for some reason none of the content which is below that c:set-tag is
rendered. All the content that's above the c:set-tag is rendered twice.
Does anyone know what the problem could be? We use taglibs-standard v1.1.2 and
jstl-v1.1.2 in our project. I tried jstl-v1.2 but with the same problem. I
already tried to remove the taglibs-standard or the jstl-library but with no
result.
This is the configuration of the tiles:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<!-- DEFAULT MAIN TEMPLATE -->
<definition name="template" template="/WEB-INF/jsp/template/template.jsp">
<put-attribute name="header" value="/WEB-INF/jsp/header.jsp" />
<put-attribute name="menu" value="/WEB-INF/jsp/menu.jsp" />
<put-attribute name="footer" value="/WEB-INF/jsp/footer.jsp" />
</definition>
<!-- Pages -->
<definition name="welcome" extends="template" />
</tiles-definitions>
When we add this to the menu.jsp:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<div>
<p>TESTING TESTING</p>
<c:if test="true">
<p>TESTING 1 TESTING 1</p>
</c:if>
<c:set var="bodyContent" value="Body Content defined by and el" />
</div>
We get as a result twice TESTING TESTING TESTING 1 TESTING 1 and the last </div>
isn't rendered. So c:if works (c:choose also), so the problem doesn't lie with
the core library. I think the problem is with scopes, but I really have no
idea what could be the cause of this problem.
This is my spring configuration:
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-def.xml</value>
</list>
</property>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="order" value="1" />
<property name="viewClass"
value="org.springframework.web.servlet.view.tiles2.TilesView" />
</bean>
I've been looking at this for hours and I have really no idea what the problem
could be. I checked the example that comes with the tiles distribution, but I
can't see any difference between that and my application. Everything is
deployed on Weblogic 9, so there's support for servlet specs 2.4 and JSP 2.0.
I really hope someone on this mailinglist can figure out the problem.
Also, when i add c:set variable to the template page, I get this stacktrace:
org.apache.tiles.TilesException: Error including path
'/WEB-INF/jsp/template/template.jsp'. erroneous handlers
at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:427)
at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370)
at
org.springframework.web.servlet.view.tiles2.TilesView.renderMergedOutputModel(TilesView.java:75)
at
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:258)
at
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1174)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3231)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2002)
at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1908)
at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1362)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: java.io.IOException: Error including path
'/WEB-INF/jsp/template/template.jsp'. erroneous handlers
at
org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:201)
at
org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:185)
at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:419)
... 22 more