Search code examples
jsfjsf-1.2

JSF website and redirecting pages


I have a website that was written using JSF 1.2. I've been made aware that on one of our pages, you click a button and and http redirect is supposed to occur. This is not working.

My JSF file contains the button:

<h:commandButton immediate="true"
                 action="#{jLoginFragment.btnLogin_onClick}" 
                 id="btnLogin"
                 value="Login"
                 styleClass="buttonComp"/>

My bean contains:

public String btnLogin_onClick() {
    System.out.println ('TEST');
    FacesContext.getCurrentInstance().getExternalContext().redirect("/test.html");
    return null;
}

When I click on the button, the btnLogin_onClick() is executed (as I can see the 'TEST' message, but the redirect does not happen.

No exceptions are thrown, so I'm a little stuck on what to do here. Can anyone help?


Solution

  • I've discovered that the Google Tag Manager code we have on our site is causing the redirect not to work. I've removed the tag manager code for this particular page.