Its nice to know that the reference implementation suffers from the
same bug we found (GNUJSP 1.0) to be inherited in the spec examples,
too.
Background: (I suppose you use jsp:include somewhere in your code
or call "out.flush()" ?
If something goes wrong while doing an jsp:include
or after doing jsp:include or out.flush() which throws
an exception you won't get the exception printed but
instead always get
java.io.IOException: Error: Attempt to clear a buffer that's already
benn flushed
Setting up an error page won't help.
IMHO:
The generated code should not use out.clear() but out.clearBuffer()
Workaround:
Put all your "<% %>" in a big try statement .
>This is a multi-part message in MIME format.
>
>------=_NextPart_000_0058_01BF05ED.84B20330
>Content-Type: text/plain;
> charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>Greetings,
> I'm using JSP to develop a website. I have one JSP page (named =
>StudentDetails.jsp) which
>shows details of all the students. It has the following codes:
>
> <% Student students[] =3D stuBean.getStudents(); // where =
>stuBean is the java bean in this page
> =20
> for ( int i =3D 0; i < students.length; i++)
> {
> Student oneStudent =3D students[i];
> %> <%@ include file=3D"StudentDetails.jsp" %>
> <% }
> %>
>
>
> Where StudentDetails.jsp is a page showing details of one student. =
>However, when I try to run
>the page, I got the following error:
>Unhandled error! You might want to consider having an error page to =
>report such errors more gracefully
>java.io.IOException: Error: Attempt to clear a buffer that's already =
>been flushed
> at =
>com.sun.jsp.runtime.JspWriterImpl.clear(JspWriterImpl.java:115)
> at =
>D_0003a.jswdk_0002d_00031_0005f_00030.examples.jsp.Project.StudentDetails=
>_jsp_1._jspService(StudentDetails_jsp_1.java, Compiled Code)
> at com.sun.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
> at =
>com.sun.jsp.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:=
>88)
> at =
>com.sun.jsp.runtime.JspServlet.serviceJspFile(JspServlet.java:218)
> at com.sun.jsp.runtime.JspServlet.service(JspServlet.java:294)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
> at =
>com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155)
> at com.sun.web.core.Context.handleRequest(Context.java:414)
> at =
>com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:139)
>
>Is there anything wrong with my code? Pls help. TIA!=20
>
>=3D=3D=3D
>Regards,
>June
> =20
>
>
>------=_NextPart_000_0058_01BF05ED.84B20330
>Content-Type: text/html;
> charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
><HTML><HEAD>
><META content=3D"text/html; charset=3Diso-8859-1" =
>http-equiv=3DContent-Type>
><META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
><STYLE></STYLE>
></HEAD>
><BODY bgColor=3D#ffffff>
><DIV><FONT face=3D"Maiandra GD" size=3D2>Greetings,</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> I'm using =
>JSP to develop=20
>a website. I have one JSP page (named StudentDetails.jsp) =
>which</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2>shows details of all the =
>students. It=20
>has the following codes:</FONT></DIV>
><DIV> </DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> =20
><% Student students[] =3D=20
>stuBean.getStudents(); // where stuBean is the java =
>bean in=20
>this page</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD"=20
>size=3D2> &nbs=
>p; </FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> =
> =20
> for ( int i =3D 0; i <=20
>students.length; i++)</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> =
> =20
> {</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> =
> =20
> Student =
>oneStudent =3D=20
>students[i];</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> =
>%> =20
><%@ include file=3D"StudentDetails.jsp" %></FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> =
><% =20
> }</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> =
>%></FONT></DIV>
><DIV> </DIV>
><DIV> </DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> Where =
>StudentDetails.jsp=20
>is a page showing details of one student. </FONT><FONT =
>face=3D"Maiandra GD"=20
>size=3D2>However, when I try to run</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2>the page, I got the following=20
>error:</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2>Unhandled error! You might want =
>to consider=20
>having an error page to report such errors more=20
>gracefully<BR>java.io.IOException: Error: Attempt to clear a buffer =
>that's=20
>already been flushed<BR> at=20
>com.sun.jsp.runtime.JspWriterImpl.clear(JspWriterImpl.java:115)<BR> =
> =20
>at=20
>D_0003a.jswdk_0002d_00031_0005f_00030.examples.jsp.Project.StudentDetails=
>_jsp_1._jspService(StudentDetails_jsp_1.java,=20
>Compiled Code)<BR> at=20
>com.sun.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)<BR> &nb=
>sp; =20
>at=20
>javax.servlet.http.HttpServlet.service(HttpServlet.java:840)<BR> &nb=
>sp; =20
>at=20
>com.sun.jsp.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:=
>88)<BR> =20
>at=20
>com.sun.jsp.runtime.JspServlet.serviceJspFile(JspServlet.java:218)<BR>&nb=
>sp; =20
>at=20
>com.sun.jsp.runtime.JspServlet.service(JspServlet.java:294)<BR> &nbs=
>p; =20
>at=20
>javax.servlet.http.HttpServlet.service(HttpServlet.java:840)<BR> &nb=
>sp; =20
>at=20
>com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155)<BR=
>> =20
>at=20
>com.sun.web.core.Context.handleRequest(Context.java:414)<BR> &=
>nbsp; =20
>at=20
>com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:139)</FON=
>T></DIV>
><DIV> </DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2>Is there anything wrong with my =
>code? Pls=20
>help. TIA! </FONT></DIV>
><DIV> </DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2>=3D=3D=3D</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2>Regards,</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2>June</FONT></DIV>
><DIV><FONT face=3D"Maiandra GD" size=3D2> =
></FONT></DIV>
><DIV> </DIV></BODY></HTML>
>
>------=_NextPart_000_0058_01BF05ED.84B20330--
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST"
.
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
Ciao,
Carsten Heyl
Carsten Heyl [EMAIL PROTECTED]
NADS - Solutions on Nets http://www.nads.de/
NADS GmbH http://www.pixelboxx.de/
Hildebrandtstr. 4E Tel.: +49 211 933 02-90
D-40215 Duesseldorf Fax.: +49 211 933 02-93
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html