Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hi i can't understand why this code is giving me error..

9 views
Skip to first unread message

eugene kim

unread,
Aug 13, 2002, 11:54:43 AM8/13/02
to
error msg-----
Attempt to clear a buffer thats already been flushed???
-------------

HttpSession aSession = request.getSession(true);

String destination = "/login.jsp?returnPage=/practice/reviewcontent.jsp";
try{
if(aSession.getValue("userId") == null) {

%>
<jsp:forward page="<%= destination %>" />
<%
}
%>


thank you

eugene kim

unread,
Aug 13, 2002, 12:09:44 PM8/13/02
to
oops..
forgot to take out "try{" on first post..


error msg ...
==================
Error: 500
Location: /practice/reviewcontent.jsp
Internal Servlet Error:

java.io.IOException: Error: Attempt to clear a buffer thats already been
flushed
at org.apache.jasper.runtime.JspWriterImpl.clear(JspWriterImpl.java:180)
at practice.reviewcontent_6._jspService(reviewcontent_6.java:93)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)

at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)

at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)

at org.apache.tomcat.modules.server.Ajp13Interceptor.processConnection(Ajp13Interceptor.java:341)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Thread.java:536)

entire code..
========================
<jsp:include page="/shared/withoutN_header.html" flush="true"/>

<%@ page import="java.util.*, practice.*, javax.servlet.*,
javax.servlet.http.*, java.io.*"%>

<%
String title=null;
String contentId = request.getParameter("contentId");
String content = request.getParameter("content");
String contentTitle = request.getParameter("contentTitle");

HttpSession aSession = request.getSession(true);

String destination =
"/login.jsp?returnPage=/practice/reviewcontent.jsp";

if(aSession.getValue("userId") == null) {

%>
<jsp:forward page="<%= destination %>" />
<%
}

title = "Review " + "<br>" + contentTitle + "<br>" + content;
String errorMsg=null;
if(request.getParameter("errorMsg") != null){
errorMsg = request.getParameter("errorMsg");
}
else
errorMsg = "";
%>
<h3>Review</h3>

<h4><%= contentTitle%></h4>

<%= content%>

<form method=post action=/servlet/practice.ReviewContent?contentId=<%=
contentId %> >

<table>
<tr>
<td align=center><font color=red>
<%= errorMsg %>
</font>
</td>
</tr>
<tr>
<td>Items marked with a * are required
</td>
</tr>

<tr><td>Rate: * </td><td><select name=rating >
<option value=> -
<option value=5>5 stars
<option value=4>4 stars
<option value=3>3 stars
<option value=2>2 stars
<option value=1>1 star

</select>
</td></tr>


<tr><td>Comments: </td><td><textarea rows=5 cols=30 name=description>
</textarea></td></tr>
<hr>
</td></tr>
<tr><td colspan=2 align=center><input TYPE=submit value="Add"></td></tr>
</table>

</form>


<jsp:include page="/shared/withoutN_footer.html" flush="true"/>

Daniel Bratell

unread,
Aug 14, 2002, 9:30:30 AM8/14/02
to
eugene kim wrote:
> java.io.IOException: Error: Attempt to clear a buffer thats already been
> flushed

You can't do a forward when you have started writing to a page, which
you seems to do with your include. You must do the forward before
writing any output to the page.

/Daniel

0 new messages