Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#121 AjaxAreaTag throws IllegalStateException

JSP_Tags
open
Jens Kapitza
AJAX (9)
5
2009-07-29
2009-07-27
No

2009-07-27 17:01:28,328 ERROR [http-8180-Processor23] core.ApplicationDispatcher (ApplicationDispatcher.java:711) - Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException
at org.apache.catalina.connector.ResponseFacade.reset(ResponseFacade.java:308)
at org.apache.catalina.core.ApplicationHttpResponse.reset(ApplicationHttpResponse.java:119)
at org.apache.catalina.core.ApplicationHttpResponse.reset(ApplicationHttpResponse.java:119)
at javax.servlet.ServletResponseWrapper.reset(ServletResponseWrapper.java:182)
at javax.servlet.ServletResponseWrapper.reset(ServletResponseWrapper.java:182)
at net.sourceforge.ajaxtags.tags.AjaxAreaTag.initParameters(AjaxAreaTag.java:124)
at net.sourceforge.ajaxtags.tags.BaseAjaxBodyTag.doStartTag(BaseAjaxBodyTag.java:107)

Discussion

    • labels: --> AJAX
    • milestone: --> JSP_Tags
    • assigned_to: nobody --> jenskapitza
     
  • A bit more information:
    Tomcat 5.5.27
    Struts 1.2.9
    Using a <tiles:include> tag will set the response.commited to true even with the flush="false" attribute, causing later on the IlegalStateException.
    Shouldn't initParameters be more like:
    public void initParameters() throws JspException {
    if (isAjaxRequest() ) {
    if(getHttpServletResponse().isCommitted()) {
    throw new JspException("try to avoid flush befor");
    } else {
    getHttpServletResponse().reset();
    }
    }
    }
    so the response gets only reseted for Ajax responses?
    Why is it reseted in the first place?
    B.

     
  • Jens Kapitza
    Jens Kapitza
    2009-07-29

    flush="false" is only supported in JSP version 1.2 check which one you are using.
    we need to reset cause of wrong ajax response if you use one of those tags make sure you do not write something before this area, an include later is OK. In most situations you can avoid this error. at the moment i can't see an other workaround the error is thrown to let you know that this will not work.

    1.: Try to include later.
    2.: if you need include use flush=false and make sure you are using the right JSP version (try tomcat 6.x)

     
  • Well as you can see - I'm using Tomcat 5.5 and as such JSP 2.0 (from the tomcat site:)
    Servlet/JSP Spec Apache Tomcat version
    2.5/2.1 6.0.20
    2.4/2.0 5.5.27
    so my suggested code is fine as we only need to reset in case of an Ajax response and that piece of code works for me. Including later is not an option as I need a piece on form to be manageable dynamically but the length of the form varies so an absolute positions is impossible and we start including with our header... Tomcat 6 isn't possible by hosting constraint.
    On a side note the same jsp with the whole structure of includes and at that stage all without flush="false" worked just fine with 1.3.
    For the moment: Thanks!
    B.