0

Custom Error Page appearing below Page Causing the error

asked 2014-09-04 20:02:57 +0000

ansancle gravatar image ansancle
317 8

updated 2014-09-04 20:15:38 +0000

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>
delete flag offensive retag edit

Comments

As a temporary fix - I created a zul file and in the zscript it redirects to my desired error page (my home page). I updated the zk.xml to redirect to this temp page RedirectError.zul. Inside the zscript I put a Executions.sendRedirect("/windows/DHzHomeWindow.zul") - still not correct though

ansancle ( 2014-09-05 12:01:50 +0000 )edit

6 Answers

Sort by » oldest newest most voted
0

answered 2014-09-07 10:02:48 +0000

Darksu gravatar image Darksu
1961 1 4

Hello ansancle,

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.

Best Regards,

Darksu

link publish delete flag offensive edit

Comments

All errors just redirect to our home page. We don't want the user to ever see an error. We get them in the log and via email. You didn't post the link you are referring to. If its the reg. docs I have tried all that, it is redirecting, just not getting rid of original page.

ansancle ( 2014-09-07 12:31:16 +0000 )edit
0

answered 2014-09-08 13:18:29 +0000

serdio gravatar image serdio
1
http://www.moja-skarbonka...

I have the same error ;/

link publish delete flag offensive edit
0

answered 2014-09-08 14:42:29 +0000

mortadela gravatar image mortadela
1
http://www.portfelfinanso...

some1 can help with this stuff ?

link publish delete flag offensive edit
0

answered 2014-09-09 08:51:56 +0000

Darksu gravatar image Darksu
1961 1 4

Hello ansancle,

For some reason, the url was not posted. Please find it below:

http://books.zkoss.org/wiki/ZKConfigurationReference/zk.xml/Theclient-configElement/Theerror-reloadElement

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.

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2014-09-09 12:29:51 +0000

ansancle gravatar image ansancle
317 8

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.

link publish delete flag offensive edit
0

answered 2014-10-01 09:06:44 +0000

willajem gravatar image willajem
1
http://zarabiamyzbankami....

i cant get it.. some1 can help me with this ?

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-09-04 20:02:57 +0000

Seen: 33 times

Last updated: Oct 01 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More