You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Keven <hi...@yahoo.ca> on 2002/09/07 04:55:08 UTC

global forward and Struts template--(error)can't forward response after it's commited

Hi, all:

I appreciate any/all helps from you.

The senario:
There is a "JoinUs" link on the top menu of a page. When I click on the link, I want the registration form displayed in the body area.

The Problem:
When I click on "JoinUs" link, I got nothing on the body area. on the log, I got the error message saying:" can't forward response after it is commited."

My Related Jsps:
---------------------------------------------------------------------------------
...
<a href="join.jsp">joinUs</a>(this link is on the top menu)
---------------------------------------------------------------------------------

join.jsp
-------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>

<template:insert template="home_template.jsp">
  
  <template:put name="header" content="header.jsp"/>
  <template:put name="body" content="joinUs_body.jsp"/> 
 
 </template:insert>  

--------------------------------------------------------------------------------------------
joinUs_body.jsp
--------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

 <logic:forward name="joinus"/> 

-------------------------------------------------------------------------------------------
Struts-config.xml
----------------------
<global-forwards>
      <forward name="joinus" path="/editRegistration.do?action=Create"/>
</global-forwards>

 <action    path="/editRegistration"
                type="com.ces.p2pbet.client.registration.EditRegistrationAction"
                name="registrationForm"
                scope="request"
                validate="false">
      <forward name="success"              path="/registration.jsp"/>
  </action>

----------------------------------------------------------------------------------------------
It complains that the response has commited when it excute "<logic:forward name="joinus"/> " in the joinUs_body.jsp.

I tried but I can't figure out what is wrong here. I appreciate your help.
Thank you very much

Regards,
Keven








Re: global forward and Struts template--(error)can't forward response after it's commited

Posted by Cedric Dumoulin <ce...@apache.org>.
Hello Keven,

The error message you got says exactly what is wrong: you can't do a
forward once the response is committed.

Checking your code, it appears that you do a forward in a page inserted
by the template. This is not possible due to jsp specification.
Templates use "include" to do the insert. A side effect is that the
output stream is flushed, and response committed. So, once you have done
an include, you can't do a forward ...

Cedric

Keven wrote:

>Hi, all:
>
>I appreciate any/all helps from you.
>
>The senario:
>There is a "JoinUs" link on the top menu of a page. When I click on the
link, I want the registration form displayed in the body area.
>
>The Problem:
>When I click on "JoinUs" link, I got nothing on the body area. on the
log, I got the error message saying:" can't forward response after it is
commited."
>
>My Related Jsps:
>---------------------------------------------------------------------------------
>...
><a href="join.jsp">joinUs</a>(this link is on the top menu)
>---------------------------------------------------------------------------------
>
>join.jsp
>-------------
><%@ page language="java" %>
><%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
>
><template:insert template="home_template.jsp">
>
>  <template:put name="header" content="header.jsp"/>
>  <template:put name="body" content="joinUs_body.jsp"/>
>
> </template:insert>
>
>--------------------------------------------------------------------------------------------
>joinUs_body.jsp
>--------------
><%@ page language="java" %>
><%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
>
> <logic:forward name="joinus"/>
>
>-------------------------------------------------------------------------------------------
>Struts-config.xml
>----------------------
><global-forwards>
>      <forward name="joinus" path="/editRegistration.do?action=Create"/>
></global-forwards>
>
> <action    path="/editRegistration"
>
type="com.ces.p2pbet.client.registration.EditRegistrationAction"
>                name="registrationForm"
>                scope="request"
>                validate="false">
>      <forward name="success"              path="/registration.jsp"/>
>  </action>
>
>----------------------------------------------------------------------------------------------
>It complains that the response has commited when it excute
"<logic:forward name="joinus"/> " in the joinUs_body.jsp.
>
>I tried but I can't figure out what is wrong here. I appreciate your help.
>Thank you very much
>
>Regards,
>Keven
>
>
>
>
>
>
>
>
>
>




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


Re: global forward and Struts template--(error)can't forward response after it's commited

Posted by Cedric Dumoulin <ce...@lifl.fr>.
Hello Keven,

The error message you got says exactly what is wrong: you can't do a
forward once the response is committed.

Checking your code, it appears that you do a forward in a page inserted
by the template. This is not possible due to jsp specification.
Templates use "include" to do the insert. A side effect is that the
output stream is flushed, and response committed. So, once you have done
an include, you can't do a forward ...

Cedric

Keven wrote:

>Hi, all:
>
>I appreciate any/all helps from you.
>
>The senario:
>There is a "JoinUs" link on the top menu of a page. When I click on the link, I want the registration form displayed in the body area.
>
>The Problem:
>When I click on "JoinUs" link, I got nothing on the body area. on the log, I got the error message saying:" can't forward response after it is commited."
>
>My Related Jsps:
>---------------------------------------------------------------------------------
>...
><a href="join.jsp">joinUs</a>(this link is on the top menu)
>---------------------------------------------------------------------------------
>
>join.jsp
>-------------
><%@ page language="java" %>
><%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
>
><template:insert template="home_template.jsp">
>  
>  <template:put name="header" content="header.jsp"/>
>  <template:put name="body" content="joinUs_body.jsp"/> 
> 
> </template:insert>  
>
>--------------------------------------------------------------------------------------------
>joinUs_body.jsp
>--------------
><%@ page language="java" %>
><%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
>
> <logic:forward name="joinus"/> 
>
>-------------------------------------------------------------------------------------------
>Struts-config.xml
>----------------------
><global-forwards>
>      <forward name="joinus" path="/editRegistration.do?action=Create"/>
></global-forwards>
>
> <action    path="/editRegistration"
>                type="com.ces.p2pbet.client.registration.EditRegistrationAction"
>                name="registrationForm"
>                scope="request"
>                validate="false">
>      <forward name="success"              path="/registration.jsp"/>
>  </action>
>
>----------------------------------------------------------------------------------------------
>It complains that the response has commited when it excute "<logic:forward name="joinus"/> " in the joinUs_body.jsp.
>
>I tried but I can't figure out what is wrong here. I appreciate your help.
>Thank you very much
>
>Regards,
>Keven
>
>
>
>
>
>
>
>
>  
>



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


Re: global forward and Struts template--(error)can't forward response after it's commited

Posted by Keven <hi...@yahoo.ca>.
Please help me on the following issue.
Thank you very much.

Keven
----- Original Message -----
From: "Keven" <hi...@yahoo.ca>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, September 06, 2002 10:55 PM
Subject: global forward and Struts template--(error)can't forward response
after it's commited


Hi, all:

I appreciate any/all helps from you.

The senario:
There is a "JoinUs" link on the top menu of a page. When I click on the
link, I want the registration form displayed in the body area.

The Problem:
When I click on "JoinUs" link, I got nothing on the body area. on the log, I
got the error message saying:" can't forward response after it is commited."

My Related Jsps:
----------------------------------------------------------------------------
-----
...
<a href="join.jsp">joinUs</a>(this link is on the top menu)
----------------------------------------------------------------------------
-----

join.jsp
-------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>

<template:insert template="home_template.jsp">

  <template:put name="header" content="header.jsp"/>
  <template:put name="body" content="joinUs_body.jsp"/>

 </template:insert>

----------------------------------------------------------------------------
----------------
joinUs_body.jsp
--------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

 <logic:forward name="joinus"/>

----------------------------------------------------------------------------
---------------
Struts-config.xml
----------------------
<global-forwards>
      <forward name="joinus" path="/editRegistration.do?action=Create"/>
</global-forwards>

 <action    path="/editRegistration"

type="com.ces.p2pbet.client.registration.EditRegistrationAction"
                name="registrationForm"
                scope="request"
                validate="false">
      <forward name="success"              path="/registration.jsp"/>
  </action>

----------------------------------------------------------------------------
------------------
It complains that the response has commited when it excute "<logic:forward
name="joinus"/> " in the joinUs_body.jsp.

I tried but I can't figure out what is wrong here. I appreciate your help.
Thank you very much

Regards,
Keven









______________________________________________________________________ 
Post your ad for free now! http://personals.yahoo.ca

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