jeudi 28 mai 2015

Debuging a java file using Netbeans debuger, message: no variables to display because there is no current thread

I am trying to debug a java ManagedBean using Netbeans. I am new to programming, so I add a BreakPoint at the line ConfigurableNavigationHandler nav and I click Debug, but it says no variables to display because there is no current thread. What I am doing wrong?

 package controllers;

    import javax.inject.Named;
    import javax.faces.application.ConfigurableNavigationHandler;
    import javax.faces.bean.SessionScoped;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ComponentSystemEvent;


    @Named(value = "redirectManagedBean")
    @SessionScoped
    public class RedirectManagedBean{

        /**
         * Creates a new instance of RedirectManagedBean
         */
        public RedirectManagedBean() {

        }

        public void isAdmin(ComponentSystemEvent event)
        {

            FacesContext fc = FacesContext.getCurrentInstance();


            ConfigurableNavigationHandler nav 
               = (ConfigurableNavigationHandler) 
                fc.getApplication().getNavigationHandler();

            String user="a";

            if (user.equals("a")) 
            {          
                nav.performNavigation("login?faces-redirect=true");
            } 
            else 
            {
                nav.performNavigation("welcome?faces-redirect=true");
            }
        }   
    }

Aucun commentaire:

Enregistrer un commentaire