Java Magazine, Jan/Feb 2016
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2016 29 web apps getter In a JSF page the o tree does the work o tree value treeBean tree var t o treeNode ul o treeNodeItem li t o treeInsertChildren li o treeNodeItem ul o treeNode o tree The output is shown in Figure 2 The full application is available in the Tree app in the downloadable code Use the full Ajax exception handler Starting with JSF 2 there is a generic API that enables developers to write a global exception handler This is very helpful especially when we need to signal silent exceptions such as Ajax exceptions that are not reported to the user or are reported in a very discreet manner As you probably know exceptions that occur during Ajax requests are not treated the same as exceptions that occur during non Ajax requests By default most of them are invisible to the client Because users do not receive any feedback about the success of Ajax requests users might become confused and restart the application resend the request or take other actions The OmniFaces FullAjaxExceptionHandler enables developers to handle exceptions that occur during Ajax requests by using error pages configured in web xml or web fragment xml To exploit the FullAjax ExceptionHandler we need to explicitly configure the FullAjaxExceptionHandlerFactory in facesconfig xml factory exception handler factory org omnifaces exceptionhandler FullAjaxExceptionHandlerFactory exception handler factory factory In the snippet above lines 3 and 4 should be entered as a single line Ed It is good practice to provide at least a fallback error page whenever there is no match with any of the declared specific exceptions Now Ajax exceptions will not occur imperceptibly for the user because they will be reported in the configured error page The user will now know that something went wrong via messages in the error page and can act accordingly So you must at least have either Figure 2 Simple tree output
You must have JavaScript enabled to view digital editions.