This page demonstrates Clicks error handling.
NullPointerException
This error is caused by the Pages onExceptionClick() method throwing a NullPointerException. Note how the error report shows you the exact line where the error occurred. Click will do this if it can find the Java source code on the classpath or under the WEB-INF directory.
NoSuchMethodException
This error is caused by a Control action listener being set to a method which doesn't exist. Typically a typo error when setting Control listeners. When the control attempts to call the listeners callback method it will throw a NoSuchMethodException. In this example the Java source code is not available, so the error source is not highlighted.
Broken Page Border Template
This error is caused by an invalid Velocity expression in a page border template. When Velocity tries to parse this expression it will throw a ParseErrorException. At this point no output will have been written to the HttpServletResponse and the ErrorPage will render the error report in the error.htm page template. Note these types of exceptions are pretty rare. Most of the time Velocity will ignore template errors and simply render the invalid template code.
Broken Page Content Template
This is another example of an invalid Velocity expression, but this time it is contained in the page content template. When a exception occurs in a content template, Velocity will be performing a merge of the Page model and the border template, and including the content template. At this point Velocity will most probably have written border template output to the HttpServletResponse so the ClickServlet appends the error report to the response output stream before it is closed.
Broken Renderer
This error is caused by a Page model object throwing a NPE when being rendered by Velocity. When Velocity tries to merge the page model with the template, it will call the objects toString() method which throws a NullPointerException. As this error usually occurs after some contents has been written to the HttpServletResponse Click will append the error report to the end of the response.
  • Line 1
  • $brokenRenderer   <- clicking on link will add BrokenRenderer to page model
  • Line 3
Page Not Found
When the ClickServlet cannot find a requested page it will render the click/not-found.htm page.
You can custome is this page templates to suite your own needs.