Hello,

Usually exception that being thrown by the VIEW(JSP) are rendering related
exception. 
This could be tags/Scriptlet that access resource, JavaBeans, fails.
Meaning the
Resource is not there.  And when these thing happen with composite view
thing became
A bit tricky.  First of all, within the container, the layout, of the
composite view
You don't where exception might be thrown.  Second, the page directive for
'errorPage'
Can only be set at the outter most container, the layou, and not within any
of its 
Contained JSP.  Since, you never know when response has been committed to
the client
Browser.  And if response has already committed to the clien browser, any
attemp to 
Forward to a different resource is an IllegalStateException.  A quick
solution to your 
Problem is to only have the page directive for your JSP is in the outer most
container,
The layout.  

My approach to handling the front-end exception in Struts1+ is having a
sub-module for 
Handling exception with a set of custom or generic ExceptionHandler, with
action mapping
That will capture the exception, do exception profiling or anything
neccessarry, and use
Struts declarative exception handling to map it to a user friendly View for
displaying 
Specific error pages.  This has to work with the Web application error
mapping in the
Web.xml deployment descriptor, to map different error-code and exception to
the right 
Action mapping in your exception sub-module that will handle the exception.
I think 
This is a much cleaner way to haddle exception since it promote
encapsulation of exception
Handling into one central place, the sub-module, that can be manage easily
and consistent 
Through out the entire application.  Plus, exception handler can be reused
in different 
Web application with the entire enterprise.

Hope this would help,

-danny

-----Original Message-----
From: atta ur-rehman [mailto:[EMAIL PROTECTED]] 
Sent: Monday, November 18, 2002 9:52 AM
To: struts users mailing list
Subject: Howto handle this behavior in Struts+Tiles


Dear all,

Here is my "layout.jsp" file:

<%@ page errorPage="ErrorPage.jsp" %>

     <tiles:insert attribute="menu"/>
     <tiles:insert attribute="body"/>
     <tiles:insert attribute="footer"/>

The "menu" tile is a JSP page that could throw an exception. Now whenever an
exception is thrown on the "menu" tile I want to goto JSP Error Page. What I
get instead is this exception:

[Exception in:/main-menu.jsp] reset() failed - data has already been sent to
client java.lang.IllegalStateException: reset() failed - data has already
been sent to client.

Could you please help me with this one? What do I need to fix this problem.
By the way "menu.jsp" contains <%@ page errorPage="ErrorPage.jsp" %>
directive. And currently if there is an exception on "layout.jsp" Error Page
does show up with appropriate error message.

TIA,

ATTA


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

Reply via email to