Hi there,
I'm using declarative exception handling with struts 1.3 using the
<global-exceptions> element as follows:-
<global-exceptions>
<exception key="error.exception.invalidMagazine"
type="java.lang.Exception"
handler="com.dovetailservices.sol3.services.exception.Sol3ExceptionHandler"
path="/WEB-INF/pages/error.jsp">
</exception>
</global-exceptions>
This works fine, however instead of forwarding to a jsp (error.jsp)
I'd like to forward to a tiles definition when an exception is caught,
like so:-
<global-exceptions>
<exception key="error.exception.invalidMagazine"
type="java.lang.Exception"
handler="com.dovetailservices.sol3.services.exception.Sol3ExceptionHandler"
path=".error">
</exception>
</global-exceptions>
However this doesn't work. Is there any way of getting this working?
Thanks in advance,
Stuart
stu - 16 May 2007 09:54 GMT
Ok I've found a way around this....
Instead of trying to forward to a tiles definition, I forwarded to a
jsp containing a tiles implementation of a tiles layout:-
So in struts-config.xml we have:-
<global-exceptions>
<exception key="error.exception.invalidMagazine"
type="java.lang.Exception"
handler="com.dovetailservices.sol3.services.exception.Sol3ExceptionHandler"
path="/WEB-INF/pages/error.jsp">
</exception>
</global-exceptions>
Where error.jsp is as below, implementing a tiles layout jsp called
main_layout.jsp:-
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<tiles:insert page="/WEB-INF/templates/main_layout.jsp"
flush="true">
<tiles:put name="title" value="error" />
<tiles:put name="header" value="/WEB-INF/pages/header.jsp" />
<tiles:put name="menu_nav" value="/WEB-INF/pages/domain_menu.jsp" /
<tiles:put name="body" value="/WEB-INF/pages/body.jsp" />
<tiles:put name="footer" value="/WEB-INF/pages/footer.jsp" />
</tiles:insert>
This isn't as neat as using a tiles definition in tiles-defs.xml but
it does the job.