You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Cedric Dumoulin <ce...@lifl.fr> on 2002/04/04 12:52:39 UTC

Re: Tiles and struts action

  The jsp specification says that it is forbidden to do a forward once the response
has been committed.
  Response is committed once you have written something to the resulting page. So,
generally you can't do a forward once you have started writing the response.
  The only thing you can do is an include, or a send redirect (but in this latest
case you will loose your current request).

    Hope this help,

      Cedric



"Wellie W. Chao" wrote:

> More generally, is it possible to forward from within a child tile? I know
> I can forward within the original page, but I can't seem to get forwarding
> working from within a layout page or an included tile. I've tried
> increasing the buffer size with <%@ page buffer="32kb" %>, but this
> doesn't do anything. I've also tried <tiles:insert ... flush="false">, but
> the flush attribute doesn't make a difference. I still get the message
> about an inability to forward because the response has already been
> committed. Does anyone have clues on why this behavior occurs? Does Tiles
> flush the headers and part of the page out before loading the layout? Can
> I disable this behavior somehow?
>
> On Thu, 28 Mar 2002, Wellie W. Chao wrote:
>
> > Date: Thu, 28 Mar 2002 22:23:58 -0500 (EST)
> > From: Wellie W. Chao <wc...@caraveltech.com>
> > Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> > To: Struts Users Mailing List <st...@jakarta.apache.org>
> > Subject: Re: Tiles and struts action
> >
> > Did you ever figure out the solution to the Response has been committed
> > problem? I am now having a similar problem with a custom tag. I have a tag
> > called checkLogin that I place in a page like so:
> >
> > -----
> > <%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>
> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> > <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
> >
> > <app:checkLogin role="admin"/>
> > <html:html locale="true">
> > ...
> > </html:html>
> > -----
> >
> > I get the following error:
> > [ServletException in:/tiles-layouts/adminLayout.jsp]
> > java.lang.IllegalStateException: Cannot forward after response has been
> > committed'
> >
> > The code for the checkLogin tag checks to see if a user is logged in. If
> > so, and he is in the role, the tag does nothing. If not, the tag forwards
> > to the login page.
> >
> > I would rather use the tag than container-based security because I want to
> > protect pages by classes of layout rather than by directory structure.
> >
> > On Wed, 13 Mar 2002, Hill, Donald wrote:
> >
> > > Date: Wed, 13 Mar 2002 09:48:54 -0500
> > > From: "Hill, Donald" <dh...@silverstream.com>
> > > Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> > > To: "Struts Users Mailing List (E-mail)" <st...@jakarta.apache.org>
> > > Subject: FW: Tiles and struts action
> > >
> > >
> > > -----Original Message-----
> > > From: Hill, Donald
> > > Sent: Tuesday, March 12, 2002 12:44 PM
> > > To: 'Jakarta Tag Libraries Users List' (E-mail)
> > > Subject: Tiles and struts action
> > >
> > >
> > > I am trying to use a struts action in a tile definition, something like
> > > this.
> > >
> > >
> > > <definition name="site.mainLayout" path="/layouts/classicLayout.jsp">
> > > <put name="title" value="Tiles Blank Site" />
> > > <put name="header" value="/tiles/common/header.jsp" />
> > > <put name="menu" value="site.menu.bar" />
> > > <put name="footer" value="/tiles/common/footer.jsp" />
> > > <put name="body" value="/tiles/body.jsp" />
> > > </definition>
> > >
> > >
> > > <definition name="site.index.page" extends="site.mainLayout" >
> > > <put name="title" value="Tiles Blank Site Index" />
> > > <put name="body" value="jobList.do" />
> > > </definition>
> > >
> > > I always get a Response has been committed on the template page.
> > > Is there a trick to using a struts action in tiles or template tags that I
> > > am missing.
> > >
> > > -Don-
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> >
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>