Hi,
i have a major problem with the exception-handling in the HibernateSessionRequestFilter.
Hibernate version: 3.2 Core
Struts version: 1.2
Tiles version: 1.1
Tomcat version: 5.5
I found the following entry with additional comments in the wiki:
http://www.hibernate.org/43.html
Everything works fine for except one thing:
Displaying the exception to the user.
I tried the following approaches:
1. Adding
<%@ page buffer="128kb" autoFlush="false"%> (Large buffer for testing) to the main tiles-layout jsp and
"flush=false" in every tiles-insert.
2. Adding this code to the catch-block in the filter:
HttpServletRequest req = (HttpServletRequest) request;
RequestDispatcher rd = req.getRequestDispatcher("/staticContent.do?def=page.exception");
rd.forward(request, response);
This still causes that the next jsp called in the struts forward is rendered even if a database-exception happens and the redirect is called in the filter. Additionally a
"java.lang.IllegalStateException: Cannot forward after response has been committed" is thrown but this has no impact on the rendered jsp.
I also tried the approach, described in the wiki-comment, which suggest to add a
addErrorMessage method to add struts-action-errors to the session if a exception is thrown in the filter. This doesn't work for me too.
As far as i can see there is no way for me to direct to a error page after
chain.doFilter(request, response); is called in case an exception occurs.
Any help or suggestions for me? THX in advance!