First time here? Check out the FAQ!
In my application, if there is ANY unhandled exception, we redirect to the home page via the error-page directive in zk.xml. This has worked fine forever, suddenly the redirects are no longer happening properly. The page that caused the exception remains on the screen in the browser, the page that the error-page directive specifies appears BELOW the page that caused the error.
Since all my .zul's use the same window id (no 2 are ever present at the same time) I also get a duplicate id error since the original window has not gone away when the new window (my home page) is supposed to be loaded. I changed the home page id to allow to show, but again, it appears below the original page instead of replacing it.
I can't figure out what changed to make this no longer work properly.
Here is my directive in zk.xml :
<error-page> <device-type>ajax</device-type> <exception-type>java.lang.Throwable</exception-type> <location>/windows/DHzHomeWindow.zul</location> </error-page>
and in web.xml
<error-page> <exception-type>java.lang.IllegalStateException</exception-type> <location>/windows/error/DHzIllegalStateExceptionErrorWindow.zul</location> </error-page> <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/windows/DHzHomeWindow.zul</location> </error-page>
answered 2014-09-07 10:02:48 +0000Darksu
First of all you should set unique window id's to all your application or else unexpected problems could occur.
Furthermore the following link shows how you can configure your application when an un-caught exception are thrown.
Finally i would prefer creating a domain model, where i could set the exception id's and types, and then i would redirect to a respective error page.
answered 2014-09-09 08:51:56 +0000Darksu
For some reason, the url was not posted. Please find it below:
Furthermore, it would be best, if you handled all the errors in your application with proper try-catches, so that the user will never see an error, and you will be able to handle it as you see fit. It's just that simple.
Please let me know if you need any assistance.
answered 2014-09-09 12:29:51 +0000ansancle
We have a very large application, with extensive error handling. Errors that should never happen (meaning a coding issue) are allowed to propagate, so we catch them and fix them. It is these errors we are dealing with. I looked at the spec you referred me to, are any of those a "catch-all" like Throwable is for the error-page directive?
For anyone else watching this thread, I did this in the mean time until I get this properly sorted.
Create a zul page (I called it DHzErrorRedirector.zul) and specify that in your zk.xml :
<error-page> <exception-type>java.lang.Throwable</exception-type> <location>/windows/error/DHzErrorRedirector.zul</location> </error-page>
Then place the following inside that zul file :
<zk xmlns:h="http://www.w3.org/1999/xhtml" xmlns:zk="http://www.zkoss.org/2005/zk"> <zscript> Executions.sendRedirect("/windows/DHzHomeWindow.zul"); </zscript> </zk>
Replace "/windows/DHzHomeWindow.zul" with the page you want and you will no longer get the stacked pages with the original on top and the error page on the bottom.
Asked: 2014-09-04 20:02:57 +0000
Seen: 33 times
Last updated: Oct 01 '14