Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp:include Error in Websphere 4.0  RSS feed

Madhu Menon
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66203
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is a Webshpere-specific problem, I'm going to shuffle this off to the Websphere forum where the IBM-savvy hang out.
David O'Meara
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!