Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Struts exception handling with tiles

Thread view: 
stu - 14 May 2007 13:40 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.