title: <p:commandButton> doesn't navigate when actionListener=“#{bean.method}” is declared
body: <p>I am trying to create a page which allows a user to logon to the system and then navigates to the homepage. I have managed to get it to do one or the other but cannot work out how to get it to do both. I have crawled through all the sites and cannot find a suitable answer. Please help. My code is as follows:
  XHTML:</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;p:growl id="growl" showDetail="true" life="3000" /&gt;
      &lt;h:panelGrid columns="2" cellpadding="5"&gt;
          &lt;h:outputLabel for="username" value="Username: " /&gt;
          &lt;p:inputText value="#{login.username}" id="username" required="true"
              label="username" /&gt;
          &lt;h:outputLabel for="password" value="Password: " /&gt;
          &lt;h:inputSecret value="#{login.password}" id="password" required="true"
              label="password" /&gt;
          &lt;p:commandButton ajax="false" id="loginButton" value="Login"
              update="growl" actionListener="#{login.login}" /&gt;
      &lt;/h:panelGrid&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Java Class:</p>
  
  <pre><code>@ViewScoped
  @ManagedBean
  @SessionScoped
  public class Login implements Serializable
  {
  private static final long serialVersionUID = 1L;
  private String username;
  private String password;
  
  public String login(ActionEvent actionEvent)
  {
      RequestContext context = RequestContext.getCurrentInstance();
      FacesMessage msg = null;
      boolean loggedIn = false;
  
      if(username != null &amp;&amp; username.equals("admin") &amp;&amp; password != null &amp;&amp; password.equals("admin"))
          {
              loggedIn = true;
              msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Welcome", username);
          }
      else
      {
          loggedIn = false;
          msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Login Error", "Invalid Credentials");
      }
      FacesContext.getCurrentInstance().addMessage(null, msg);
      context.addCallbackParam("loggedIn", loggedIn);
  
      FacesContext context2 = FacesContext.getCurrentInstance();
      context2.getExternalContext().getFlash().setKeepMessages(true);
  
      return "ProEJT?faces-redirect=true";
  }
  </code></pre>
  
  <p>As Requested here is my faces-config.xml:</p>
  
  <pre><code>&lt;faces-config xmlns="http://java.sun.com/xml/ns/javaee" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
  version="2.0"&gt;
  &lt;navigation-rule&gt;
      &lt;from-view-id&gt;/login.xhtml&lt;/from-view-id&gt;
      &lt;navigation-case&gt;
          &lt;from-action&gt;#{login.login}&lt;/from-action&gt;
          &lt;from-outcome&gt;loggedin&lt;/from-outcome&gt;
          &lt;to-view-id&gt;/ProEJT.xhtml&lt;/to-view-id&gt;
      &lt;/navigation-case&gt;
  &lt;/navigation-rule&gt;
  </code></pre>
  
  <p></p>
  
  <p>When I attempted this I altered the return from my login method to "loggedin".</p>
  
  <p>Thanks for any help in advance!!</p>