I try to migrate to Struts 1.2.8, the "ServletException ..." message is not displayed any more.

Problem is that if I use the error-page of the web.xml, I got the following exception : 2006-02-01 18:58:27 ErrorDispatcherValve[localhost]: Exception Processing ErrorPage[exceptionType=java.lang.Throwable, location=/error.jsp] java.lang.IllegalStateException: Impossible de remettre ? z?ro apr?s que la r?ponse ait ?t? envoy?e at org.apache.catalina.connector.ResponseBase.reset(ResponseBase.java:742) at org.apache.catalina.connector.HttpResponseBase.reset(HttpResponseBase.java:765) at org.apache.catalina.connector.http.HttpResponseImpl.reset(HttpResponseImpl.java:156) at org.apache.catalina.connector.HttpResponseBase.reset(HttpResponseBase.java:326) at org.apache.catalina.valves.ErrorDispatcherValve.custom(ErrorDispatcherValve.java:364) at org.apache.catalina.valves.ErrorDispatcherValve.throwable(ErrorDispatcherValve.java:209) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:126) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:534) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:994) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1105)
       at java.lang.Thread.run(Thread.java:534)

If I use the <%@ page errorPage ..., the tiles bloc which fails is replaced by the content of error.jsp but not the user is not redirected.

Any idea ?

Vladislav Pernin

Vladislav Pernin wrote:

I just found in the 1.2.4 release note that this has been resolved. So I'm going to take a look at 1.2.4 migration.

Vladislav Pernin

Vladislav Pernin wrote:

Hi all,

I'm working in an Struts-1.1 tiles environment and I need to be able to redirect user on a JSP error page when an errors occurs. I also need to send an email, that can be done from the JSP error page or from an exception handler.

The global-exceptions declared in the struts-config.xml "catch" the exception that occur in the struts action only.

I also need to catch exception in the JSP, so I try to set an error-page in the web.xml, the exception thrown from the TableauBord.jsp is not caugth and an ugly "A ServletException in /jsp/TableauBord.jsp ..." is displayed instead of the content of the TableauBord.jsp inserted by <tiles:insert attribute="corps"/> in Template.jsp ; the JSP error page error.jsp is not called.

So I try to add a <%@ page errorPage="/jsp/error.jsp" %> in the pages Template.jsp and TableauBord.jsp, I got a different behaviour, the "ServletException ..." message went out but the JSP error page has still not been called. After some testing, I realised that I could put any string in the <%@ page errorPage="sdqsdsqdqsdsqd" %>, no change.

I try to use a standard JSP page, I mean without tiles templating, and my JSP error page is called with both solutions (error-page in web.xml and directive errorPage in JSP).

Maybe the response is commited before the exception is thrown ?

The web gave me some directions, I tried all of them without any success. So if you guys have an idea, it would be great.

Regards,
Vladislav Pernin

------------------------------------------------------------------------------_
Template.jsp:_

<%@ page contentType="text/html;charset=utf-8" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
            <html>
<head>
    <html:base />
    <tiles:importAttribute name="titrePage"/>
...

<body >
    <div class="top"><tiles:insert attribute="imagesEntete"/></div>
    ...
    <tiles:insert attribute="corps"/>
    ...

_TableauBord.jsp :
_JSP page where the error occurs
_titles-defs.xml :_
<definition name=".MainLayout" path="/Template.jsp">
       <put name="titrePage"  value="page.defaut.titre" />
       <put name="imagesEntete" value="/jsp/Entete.jsp" />
       <put name="corps"   value="corps" />
   </definition>
<definition name=".TableauBord" extends=".MainLayout">
<put name="corps" value="/jsp/TableauBord.jsp"/> </definition>


_struts-config.xml :_
...
<global-exceptions>
    <exception key="page.error.key"
        type="java.lang.Exception"
        path="/jsp/error.jsp"
        handler="xxx.yyy.ExceptionHandler" />
</global-exceptions>
...

_web.xml :_
<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/jsp/error.jsp</location>
</error-page>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to