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]