jsp:forward error! this is tricky!!!

Hi all,

We have a erpporeport.jsp page which is a menu page, containing

<li><a href = "erppoinitiatedreport.jsp">Initiated</a></li>

The erppoinitiatedreport.jsp page is blank and has the following:

<jsp:forward page = "erpporeportcontroller.jsp" >

<jsp:param name = "Action" value = "Initiated" />

</jsp:forward>

The erpporeportcontroller.jsp has the following:

<%

sAction = request.getParameter("Action");

if( sAction.equals("Initiated")) {

sURL = "erppoinitiatedreportpf.jsp"

}

%>

<jsp:forward page = "<%=URL%>" />

When we click the link on erpporeport.jsp, we get the following error:

java.io.IOException:Error: Attempt to clear a buffer that's already been

flushed

However, if we change erpporeport.jsp menu page to:

<li><a href = "erppoinitiatedreportpf.jsp">Initiated</a></li>

erppoinitiatedreportpf.jsp shows its contents correctly.

It appears that forwarding from erppoinitiatedreport.jsp to

erpporeportcontroller.jsp and then to erppoinitiatedreportpf.jsp brings the

error:

Any ideas why?

Thanks in advance

[1257 byte] By [traja47] at [2007-9-27 18:23:16]
# 1

My guess would be that erpporeportcontroller.jsp has some output in it before you get to the jsp:forward line. The rule is that you cannot do a jsp:forward (or an include) after you have done any output. Check over the previous lines and see if there's any print statements or any code outside the script tags.

jcolan at 2007-7-6 18:56:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Found the problem!!! I had the following statement on erppoinitiatedreport.jsp

<jsp:include page = "headerporeport.jsp" flush = "true" />

<jsp:forward page = "erpporeportcontroller.jsp">

<jsp:param name = "Action" value = "Initiated" />

</jsp:forward>

It appear that having the <jsp:include ...> before the <jsp:forward...> which redirects to another page having <jsp:forward...> brings the error.

To a certain extend this makes sense, because the erppoinitiatedreport.jsp will never show up anyway, so having the <jsp:include...> statement is not really required

Thank you for all the help

Trajano

traja47 at 2007-7-6 18:56:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...