How can I reload the same page from a managedBean in JSF?

后端 未结 2 1555
没有蜡笔的小新
没有蜡笔的小新 2020-12-09 13:44

Im implementing a login in a JSF application and have a problem with the redirection.

I want to make available the login form in every xhtml in the app, but after th

2条回答
  •  生来不讨喜
    2020-12-09 14:09

    Just redirect to the request URI.

    public void login() throws IOException {
        // ...
    
        ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
        ec.redirect(((HttpServletRequest) ec.getRequest()).getRequestURI());
    }
    

提交回复
热议问题