Problem with Redirect JSF 2

0

I have a Bean CDI Session which stores some information for use in the application while the user is logged in, but I need a control that when the other beans try to use some attribute of this Bean it is Null that the user is redirected to the information selection page.

He made the implementation in the get of the tribute in question and is valid if the current page is the page of the selection if it opens the page if it does not redirect. This solution works for some screens for other displays 500 error and I know that is not the ideal way to deal with this problem.

Any suggestions on how I can do this?

    
asked by anonymous 03.08.2016 / 18:45

1 answer

0

OmniFaces has a feature named FullAjaxExceptionHandler , which redirects you to the page you choose if given Exception is created.

Example:

public String getBla() {
    if (bla == null) {
        throw new BlaException();
    }
    return bla;
}

In web.xml :

<error-page>
    <exception-type>br.com.bla.BlaException</exception-type>
    <location>/bla.xhtml</location>
</error-page>

link

    
03.08.2016 / 19:31