tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ALEXANDROS KOTSIRAS" <ALEXANDRO...@prodigy.net>
Subject Re: Problems with JSP include and commitment
Date Sun, 18 Jun 2000 00:01:04 GMT
"java.lang.IllegalStateException: Response has already been committed"
That's a tricky error message
I get it occasionally although i do not write any output before i forward to
a jsp file.
It usually has to do with runtime errors in my beans if i remember well but
in general the root has nothing to do with
writing output before you forward.
Also if i remeber well it is related to the existence or not of the JSP
error page.
Try to define an errorPage in all you JSP files.

----- Original Message -----
From: Troy Echols <techols@lucent.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Saturday, June 17, 2000 9:47 AM
Subject: Re: Problems with JSP include and commitment


> I don't know whether I violated some mailing list etiquette with my
question, or
> if nobody has any thoughts, but I haven't heard anything in the last
couple of
> days.  Does anybody know what the mysteries are behind jsp:include.  I was
> looking at the Servlet 2.2 and JSP 1.1 specs, it seems that the
flush="true"
> setting would prevent it from ever working.  This can't be right, can it?
>
> Troy Echols wrote:
> >
> > One other addition:
> >
> > In the scenario mentioned previously, user-agent_appropriate.jsp is
re-entered
> > from each of the interaction_specific.jsp templates (which are forms).
> >
> > Troy Echols wrote:
> >
> > > I've been struggling with this problem for a couple of days.  I
> > > understand that there are issues with jsp:forward when the response
has
> > > already been committed (i.e., headers have already been written?).
What
> > > are the restrictions on jsp:include?  In practice, what does it mean
to
> > > commit the response.  I don't explicitly set any headers before I
> > > perform my jsp:include, but I keep getting the error
> > > "java.lang.IllegalStateException: Response has already been committed"
> > > at the point where my include is done.  Under what conditions might I
be
> > > "committing the response" without knowing it.  I don't have any
problems
> > > with commitment in general, but in this case I don't think I want it.
> > >
> > > Any help would be appreciated!
> > >
> > > Troy
> > >
> > > The scenario and an example follow:
> > > o main.jsp determines user-agent and forwards to
> > > user-agent_appropriate.jsp
> > > o user-agent_appropriate.jsp processes request and interacts with a
bean
> > > that contains service logic.  Based on direction from bean,
> > > user-agent_appropriate.jsp forwards to interaction_specific.jsp which
is
> > > a template for a particular class of interaction with user.  I
> > > originally was using jsp:include here, but it didn't work for the same
> > > reason.   In this case, jsp:forward was a suitable substitute.
> > > o interaction_specific.jsp template may jsp:include one or more
> > > templates for dynamic sub-interactions that may need to be done.  This
> > > is where I'm getting the error and jsp:forward is not a suitable
> > > substitute in this case.
> > >
> > > <html>
> > > <head> <title> Login Screen </title> </head>
> > > <body>
> > > <form name="getPassword" method="post"
> > > action="html/user-agent_appropriate.jsp">
> > > <center>
> > >
> > > <%@ page language="java" import="java.util.*" autoFlush="false"%>
> > >
> > > <jsp:useBean id="manager" scope="session"
> > > class="myapp.InteractionManager"/>
> > >
> > > <%Iterator it = manager.getQueuedNotificationTaskIterator();
> > >   while (it.hasNext()) {
> > >     String message = (String) it.next();
> > >     String template = manager.getTaskSpecDescription(message); %>
> > > <jsp:include page="<%= template %>" flush="true"/>
> > > <br>
> > > <%  } %>
> > >
> > > <br>
> > > Login:  <input name="currentUserID" type="text">
> > > <br>
> > > Password:  <input name="password" type="password">
> > > <br>
> > > <input type="submit" value="Login Now!">
> > > <br>
> > > <input type="submit" value="terminateSession" name="terminateSession">
> > > <input type="submit" value="assistancePlease" name="assistancePlease">
> > > </center>
> > > </form>
> > > </html>
> > >
> >
> --------------------------------------------------------------------------
> > > To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commmands, email: tomcat-user-help@jakarta.apache.org
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>


Mime
View raw message