0

I am using Below code for LOGOUT

public String logout() throws ServletException {
        cleanSession();
        FacesContext.getCurrentInstance().getExternalContext()
                .invalidateSession();
        HttpServletRequest request = (HttpServletRequest) FacesContext
                .getCurrentInstance().getExternalContext().getRequest();
        FacesContext.getCurrentInstance().getExternalContext()
                .invalidateSession();


            return "Logout";

    }

Logout.xhtml page inside login folder but i am end up with

Unable to find matching navigation case with from-view-id '/core/dashboard.xhtml' for action '#{loginBean.logout}' with outcome 'Logout'

I tried maximum solution provide in Stackoverflow but not able to get solution..I tried below code as well

public String logout() throws ServletException {
        cleanSession();
        FacesContext.getCurrentInstance().getExternalContext()
                .invalidateSession();
        HttpServletRequest request = (HttpServletRequest) FacesContext
                .getCurrentInstance().getExternalContext().getRequest();
        FacesContext.getCurrentInstance().getExternalContext()
                .invalidateSession();

        try {
            String action = request.getContextPath()
                    + "/login/Logout.xhtml";
            return action;
        } catch (Exception e) {
            LOG.error("Exception in forwarding at Logout", e);
        }
        return null;
    }

But same issue ..Can anyone tell me what the issue?

I made slight change and added this

<p:commandLink ajax="false" rendered="#{loginBean.loginStatus}"
                    value="Logout" actionListener="#{loginBean.logout}" action="Logout">

                </p:commandLink>

it was previously like this

<p:commandLink ajax="false" rendered="#{loginBean.loginStatus}"
                    value="Logout" action="#{loginBean.logout}"
                     >
                </p:commandLink>
user3696143
  • 301
  • 2
  • 6
  • 23

1 Answers1

0

You are trying to navigate from /core/ to /login/ which is another directory.

JSF implicit navigation allows you to navigate to a page in same folder or any parent folder.

Please use faces-config.xml navigation rule for this type of scenario.