Hi all: I'm using tiles for my site. Inside the template I have inserted a scriplet that, in error case (when a session bean is absent, for example), forward to the error page.
This is the template:
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<HTML>
<logic:notPresent name="stack">
<jsp:forward page="../do/uscitaDialogo"/>
</logic:notPresent>
This one of the page:
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<tiles:insert page="/templates/templatepaginatransazionale.jsp" flush="false">
<tiles:put name="corpoPagina" value="/autocarro/autocarro000body.jsp"/>
...
What I get (when an error occurs and the scriplet is invoked) is the error page, with the message: Cannot forward after response has been committed
If I don't use tiles, but jsp only, everything works fine (the client is forwarded to the correct page).
Any suggest? Thanks
-
Struts tiles problem (2 messages)
- Posted by: Aldo Funicelli
- Posted on: February 02 2005 06:08 EST
Threaded Messages (2)
- none by Ash H on February 02 2005 12:30 EST
- Tiles Commit Problem by Ryan Phelan on February 03 2005 19:27 EST
-
none[ Go to top ]
- Posted by: Ash H
- Posted on: February 02 2005 12:30 EST
- in response to Aldo Funicelli
Hi,
When forwarding the request, Tiles does not check the status of the response before forwarding it, because Tiles internally includes the JSP pages in the response and commits the response after the first forward and then tries to forward again to the next Tiles include JSP.
I would sugget try using jsp:include in the templeate or explicitly check if yor responce is commited in your action class.
or you can configure a global forward to system error page in struts config and check for that session bean in action class and forward to this page.
or
You can configure error page in web.xml (more generic) -
Tiles Commit Problem[ Go to top ]
- Posted by: Ryan Phelan
- Posted on: February 03 2005 19:27 EST
- in response to Ash H
Hi,
I've been searching for a reason why tiles commits on an <tiles:insert.... and more importantly is there any way to turn prevent tiles from committing the response? Its quite frustrating, since some of my "tiles" have forwarding in them based on certain conditions and it seems that by default tiles always commits the response. Why? Tiles just includes content, and includes don't nesseccarily commit thie responses.... right?