Re: Cannot forward after response has been committed...
Hi S S, i am solved this problem by changeing return stream .hope this helps to you File file=null; file = new File(path); return FileStreamInfo object instead of ResourceStreamInfo and pass content type and File class object. return new FileStreamInfo(contentType, file); -- View this message in context: http://struts.1045723.n5.nabble.com/Cannot-forward-after-response-has-been-committed-tp5710573p5711664.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Error: Cannot forward after response has been committed?
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 logic:notPresent scope=session name=loginForm jsp:forward page=/index.jsp/ /logic:notPresent 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]
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 logic:notPresent scope=session name=loginForm jsp:forward page=/index.jsp/ /logic:notPresent 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?
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 logic:notPresent scope=session name=loginForm jsp:forward page=/index.jsp/ /logic:notPresent 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?
Ok... Assuming you have a tiles layout definition like: definition name=.basic.layout path=/common/mainLayout.jsp put name=header value=/common/headerTile.jsp / put name=content value= / put name=footer value=/common/footerTile.jsp / /definition 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: definition name=.basic.layout path=/common/mainLayout.jsp put name=header value=.basic.layout.header / put name=content value= / put name=footer value=/common/footerTile.jsp / /definition definition name=.basic.layout.header page=/common/headerTile.jsp controllerClass=my.package.HeaderController /definition 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 tiles:insert attribute=header / 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 logic:notPresent scope=session name=loginForm jsp:forward page=/index.jsp/ /logic:notPresent 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?
Thank you so much. 2005/9/1, Guillermo Castro [EMAIL PROTECTED]: Ok... Assuming you have a tiles layout definition like: definition name=.basic.layout path=/common/mainLayout.jsp put name=header value=/common/headerTile.jsp / put name=content value= / put name=footer value=/common/footerTile.jsp / /definition 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: definition name=.basic.layout path=/common/mainLayout.jsp put name=header value=.basic.layout.header / put name=content value= / put name=footer value=/common/footerTile.jsp / /definition definition name=.basic.layout.header page=/common/headerTile.jsp controllerClass=my.package.HeaderController /definition 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 tiles:insert attribute=header / 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 logic:notPresent scope=session name=loginForm jsp:forward page=/index.jsp/ /logic:notPresent 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/