Re: Error: Cannot forward after response has been committed?
Thank you so much. 2005/9/1, Guillermo Castro <[EMAIL PROTECTED]>: > Ok... > > Assuming you have a tiles layout definition like: > > > > > > > > You can make the header content a tile definition by itself, and use that > definition to declare your Controller class, which will be the one with the > logic for forwarding: > > > > > > > > controllerClass="my.package.HeaderController"> > > > > And put the forward inside the HeaderController class: > > public void execute(ComponentContext tileContext, HttpServletRequest > request, > HttpServletResponse response, ServletContext servletContext) throws > Exception { > HttpSession session = request.getSession(false); > if(null == session || null == session.getAttribute("loginForm")) { > response.sendRedirect("/index.jsp"); > } > } > > Also, make sure that your '/common/mainLayout.jsp' page doesn't have any > html code before the invocation, or it > will make a response being sent to the client. > > Regards. > > On 9/1/05, 梁炳場 <[EMAIL PROTECTED]> wrote: > > > > What if the Tiles layout composing header, menu and body. > > > > Where the Tiles Controller belongs to? > > Does it stick one layout? > > > > Thanks > > > > 2005/9/1, Guillermo Castro <[EMAIL PROTECTED]>: > > > The error happens when part of your jsp page has already been sent to > > the > > > client. > > > > > > My recommendation would be to define a Tiles Controller (see > > > org.apache.struts.tiles.ControllerSupport) that would do the forwarding > > > logic. > > > > > > I hope this helps. > > > > > > On 9/1/05, 梁炳場 <[EMAIL PROTECTED]> wrote: > > > > > > > > Within a Tiles layout, > > > > I try to forward to another jsp when a bean not exist? > > > > > > > > But it leads to the subject line error message? > > > > > > > > In the header layout jsp, I put this > > > > > > > > > > > > > > > > > > > > > > > > If it is not allowed or it is not a good way, > > > > what is the better way or another way to do so? > > > > > > > > Thanks > > > > PC Leung > > > > > > > > - > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > -- > > > Guillermo Castro [EMAIL PROTECTED] > > > Monterrey NL, Mexico http://www.javageek.org/ > > > > > > > > > > > > -- > Guillermo Castro [EMAIL PROTECTED] > Monterrey NL, Mexico http://www.javageek.org/ > >
Re: Error: Cannot forward after response has been committed?
Ok... Assuming you have a tiles layout definition like: You can make the header content a tile definition by itself, and use that definition to declare your Controller class, which will be the one with the logic for forwarding: And put the forward inside the HeaderController class: public void execute(ComponentContext tileContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { HttpSession session = request.getSession(false); if(null == session || null == session.getAttribute("loginForm")) { response.sendRedirect("/index.jsp"); } } Also, make sure that your '/common/mainLayout.jsp' page doesn't have any html code before the invocation, or it will make a response being sent to the client. Regards. On 9/1/05, 梁炳場 <[EMAIL PROTECTED]> wrote: > > What if the Tiles layout composing header, menu and body. > > Where the Tiles Controller belongs to? > Does it stick one layout? > > Thanks > > 2005/9/1, Guillermo Castro <[EMAIL PROTECTED]>: > > The error happens when part of your jsp page has already been sent to > the > > client. > > > > My recommendation would be to define a Tiles Controller (see > > org.apache.struts.tiles.ControllerSupport) that would do the forwarding > > logic. > > > > I hope this helps. > > > > On 9/1/05, 梁炳場 <[EMAIL PROTECTED]> wrote: > > > > > > Within a Tiles layout, > > > I try to forward to another jsp when a bean not exist? > > > > > > But it leads to the subject line error message? > > > > > > In the header layout jsp, I put this > > > > > > > > > > > > > > > > > > If it is not allowed or it is not a good way, > > > what is the better way or another way to do so? > > > > > > Thanks > > > PC Leung > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > > Guillermo Castro [EMAIL PROTECTED] > > Monterrey NL, Mexico http://www.javageek.org/ > > > > > -- Guillermo Castro [EMAIL PROTECTED] Monterrey NL, Mexico http://www.javageek.org/
Re: Error: Cannot forward after response has been committed?
What if the Tiles layout composing header, menu and body. Where the Tiles Controller belongs to? Does it stick one layout? Thanks 2005/9/1, Guillermo Castro <[EMAIL PROTECTED]>: > The error happens when part of your jsp page has already been sent to the > client. > > My recommendation would be to define a Tiles Controller (see > org.apache.struts.tiles.ControllerSupport) that would do the forwarding > logic. > > I hope this helps. > > On 9/1/05, 梁炳場 <[EMAIL PROTECTED]> wrote: > > > > Within a Tiles layout, > > I try to forward to another jsp when a bean not exist? > > > > But it leads to the subject line error message? > > > > In the header layout jsp, I put this > > > > > > > > > > > > If it is not allowed or it is not a good way, > > what is the better way or another way to do so? > > > > Thanks > > PC Leung > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Guillermo Castro [EMAIL PROTECTED] > Monterrey NL, Mexico http://www.javageek.org/ > >
Re: Error: Cannot forward after response has been committed?
The error happens when part of your jsp page has already been sent to the client. My recommendation would be to define a Tiles Controller (see org.apache.struts.tiles.ControllerSupport) that would do the forwarding logic. I hope this helps. On 9/1/05, 梁炳場 <[EMAIL PROTECTED]> wrote: > > Within a Tiles layout, > I try to forward to another jsp when a bean not exist? > > But it leads to the subject line error message? > > In the header layout jsp, I put this > > > > > > If it is not allowed or it is not a good way, > what is the better way or another way to do so? > > Thanks > PC Leung > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Guillermo Castro [EMAIL PROTECTED] Monterrey NL, Mexico http://www.javageek.org/