File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes jsp:include Error in Websphere 4.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "jsp:include Error in Websphere 4.0" Watch "jsp:include Error in Websphere 4.0" New topic

jsp:include Error in Websphere 4.0

Madhu Menon

Joined: Sep 30, 2002
Posts: 2
I was using the <jsp:include page="<%=header%>"/> statement in my jsp running on Websphere 5.0 and Tomcat 4.1.18/4.1.24 . Due to certain resons I had to port my Web Application backward to Websphere 4.0 from J2EE 1.3 to J2EE 1.2.
When I do this i get this following error.
org.apache.jasper.JasperException: K:\Project\WS4\Web Content\jsp\welcome.jsp(33,33) JSPG0081E: jsp:include needs to have "flush=true"
So I changed my intial statement to
<jsp:include page="<%=header%>" flush="true"/>
Now when i try to view the page, the page specified by the header variable is displayed in the webbrowser after that i get this Exception.
Error 500: ERROR: Cannot forward. The response has already been committed.

If I try to make the the statement as
<jsp:include page="<%=header%>" flush="false"/>
I get the Following Exception.
org.apache.jasper.JasperException: K:\Project\WS4\Web Content\jsp\welcome.jsp(33,47) JSPG0082E: jsp:include page="..." flush="true" is the only valid combination in JSP 1.1

Now My issue is how can i have this set right on Websphere 4.0 / J2EE 1.2. I see it intresting that such an error has come becuse JSP:include tag is designed for such a purpose and that it is working fine with Websphere 5.0 and Tomcat.
Some say it could be an Error on Websphere 4.0 . If so is there any way out / alternative and is there a patch for websphere for this ?
It would be really great if somebody can suggest me a solution.
Thanks & Regards,
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

Since this is a Webshpere-specific problem, I'm going to shuffle this off to the Websphere forum where the IBM-savvy hang out.

[Asking smart questions] [About Bear] [Books by Bear]
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

It's not really WebSphere specific, but we can handle it here anyway.
By the looks of it, your JSP is running 'correctly', except that for some reason its design has it trying to forward after the buffer has been commited.
The reason the response is commited is easy, the jsp:include forces the buffer to flush and this commits the response. There are generally two reasons why you'd have a forward after this point:
a) you have one in your code - in this case you need to remove it and do your forward before outputting data or
b) an exception is being thrown after this point. If an exception is being thrown (80% of the time its a NullPointerException), the server tries to forward to error page, but this fails if the response is commited. You need to remove the exception, obviously!
It is sorta covered in the JavaRanch Style Guide.
subject: jsp:include Error in Websphere 4.0
It's not a secret anymore!