You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Danilo Luiz Rheinheimer <da...@floripa.com.br> on 2003/01/04 18:44:41 UTC

Tiles forward question - newbie

Hello ,

  I have a stuts/tiles web application and it uses the classic
sidebar-header-footer definition.
  I can override the contend body property using this :

<%@ taglib uri='WEB-INF/struts-tiles.tld' prefix='tiles' %>
<tiles:insert definition='sidebar-header-footer-definition'>
  <tiles:put name="content" value="cadastroInicialContent.jsp"/>
</tiles:insert>

  This works ok.
  
  But how I can override it with a page unknow at design time ?

  I am trying send it to a servlet and then I redirect it to my jsp
page :

<%@ taglib uri='WEB-INF/struts-tiles.tld' prefix='tiles' %>
<tiles:insert definition='sidebar-header-footer-definition' flush='false'>
  <tiles:put name="content" value="servletmostraregistro"/>
</tiles:insert>

  And the servlet code is :

public class ServletMostraRegistro extends HttpServlet {
  private static final String CONTENT_TYPE = "text/html";
  public void init() throws ServletException {  }
  public void destroy() {  }

  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String path = "/tileMostraRegistro"+request.getParameter("cadastro")+".jsp";
    RequestDispatcher disp = getServletContext().getRequestDispatcher(path);
    disp.forward(request, response);
  }
}

  But this fails with the message :

[Exception in:servletmostraregistro] Cannot forward after response has been committed

  How I can do it ?
  
-- 
Best regards,
 Danilo                          mailto:danilo@floripa.com.br



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


Re: Tiles forward question - newbie

Posted by John D Hume <du...@hotmail.com>.
Since this is in a tile, I think what you want in your servlet is

disp.include( request, response );

rather than

disp.forward( request, response );

If you don't want to stay in your tiles layout, then you should decide that
in your action before forwarding to a layout.

-john.

----- Original Message -----
From: "Danilo Luiz Rheinheimer" <da...@floripa.com.br>
To: <st...@jakarta.apache.org>
Sent: Saturday, January 04, 2003 12:44 PM
Subject: Tiles forward question - newbie


> Hello ,
>
>   I have a stuts/tiles web application and it uses the classic
> sidebar-header-footer definition.
>   I can override the contend body property using this :
>
> <%@ taglib uri='WEB-INF/struts-tiles.tld' prefix='tiles' %>
> <tiles:insert definition='sidebar-header-footer-definition'>
>   <tiles:put name="content" value="cadastroInicialContent.jsp"/>
> </tiles:insert>
>
>   This works ok.
>
>   But how I can override it with a page unknow at design time ?
>
>   I am trying send it to a servlet and then I redirect it to my jsp
> page :
>
> <%@ taglib uri='WEB-INF/struts-tiles.tld' prefix='tiles' %>
> <tiles:insert definition='sidebar-header-footer-definition' flush='false'>
>   <tiles:put name="content" value="servletmostraregistro"/>
> </tiles:insert>
>
>   And the servlet code is :
>
> public class ServletMostraRegistro extends HttpServlet {
>   private static final String CONTENT_TYPE = "text/html";
>   public void init() throws ServletException {  }
>   public void destroy() {  }
>
>   public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
>     String path =
"/tileMostraRegistro"+request.getParameter("cadastro")+".jsp";
>     RequestDispatcher disp =
getServletContext().getRequestDispatcher(path);
>     disp.forward(request, response);
>   }
> }
>
>   But this fails with the message :
>
> [Exception in:servletmostraregistro] Cannot forward after response has
been committed
>
>   How I can do it ?
>
> --
> Best regards,
>  Danilo                          mailto:danilo@floripa.com.br
>
>
>
> --
> 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>