title: Navigation with JSF2.0 and Primefaces 3.4
body: <p>I'm new to JSF and Primefaces and have just started working on logging in and basic navigation and I have run into a problem already. I've gone through about 10 similar questions here on SO and none of the solutions has worked for me yet so I figured I would post up my specific problem so that someone who really knows can point me in the right direction.</p>
  
  <ol>
  <li><p>Logging in: seems to work just fine as does logging out but I'm concerned because the url in the browser still says that I'm at the login screen after logging in and I used the login example straight from the Oracle EE6 docs. Login method is provided below.</p>
  
  <pre><code>public String login(){
  FacesContext context = FacesContext.getCurrentInstance();
  HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
  try{
      logger.log(Level.FINE, "User credentials: name: {0}, password: {1}", new Object[] {this.username, this.password});
      request.login(this.username, encrypt(this.password));
      logger.log(Level.FINE, "User: {0} logged in", this.username);
  }catch(ServletException e){
      logger.log(Level.SEVERE, "User: {0} login failed, password: {1}", new Object[]{this.username, encrypt(this.password)});
      context.addMessage(null, new FacesMessage("Login Failed!"));
      return "error";
  }
  return "/faces/system/index";
  </code></pre>
  
  <p>}</p></li>
  <li><p>After logging in I'm taken to the correct page in the correct directory and everything is being displayed corectly but when you hover over the links the status bar at the bottom of the browser displays the same url for all three links. Code for the page provided below.</p>
  
  <pre><code>    &lt;h:body&gt;
      &lt;p:layout fullPage="true"&gt;
          &lt;f:facet name="last"&gt;
              &lt;h:outputStylesheet library="css" name="discovery.css"&gt;&lt;/h:outputStylesheet&gt;
          &lt;/f:facet&gt;
          &lt;p:layoutUnit styleClass="headerDiv" position="north" size="100"&gt;
              &lt;h:graphicImage library="images" name="header.jpg"&gt;&lt;/h:graphicImage&gt;
          &lt;/p:layoutUnit&gt;
          &lt;p:layoutUnit styleClass="navDiv" position="west" size="200" id="navPanel"&gt;
              &lt;h:form&gt;
                  &lt;h:outputText value="Navigation Menu"&gt;&lt;/h:outputText&gt;
                  &lt;br/&gt;
                  &lt;p:commandLink value="First Time Users" update=":main"&gt;
                      &lt;f:setPropertyActionListener target="#{navigationBean.pageToDisplay}" value="tutorial.xhtml"&gt;&lt;/f:setPropertyActionListener&gt;
                  &lt;/p:commandLink&gt;
                  &lt;br/&gt;
                  &lt;p:commandLink value="Help" update=":main"&gt;
                      &lt;f:setPropertyActionListener target="#{navigationBean.pageToDisplay}" value="help.xhtml"&gt;&lt;/f:setPropertyActionListener&gt;
                  &lt;/p:commandLink&gt;
                  &lt;br/&gt;
                  &lt;h:commandLink action="#{loginBean.logout()}" value="Log Out"&gt;&lt;/h:commandLink&gt;
              &lt;/h:form&gt;
          &lt;/p:layoutUnit&gt;
          &lt;p:layoutUnit position="center" id="main"&gt;
              &lt;ui:include src="#{navigationBean.pageToDisplay}"&gt;&lt;/ui:include&gt;
          &lt;/p:layoutUnit&gt;
      &lt;/p:layout&gt;
  &lt;/h:body&gt;
  </code></pre></li>
  <li><p>The NavigationBean</p>
  
  <p>@Named(value = "navigationBean")
  @RequestScoped
  public class NavigationBean implements Serializable {</p>
  
  <p>public NavigationBean() {
    }</p>
  
  <p>public String getPageToDisplay() {
      return pageToDisplay;
    }</p>
  
  <p>public void setPageToDisplay(String pageToDisplay) {
      this.pageToDisplay = pageToDisplay;
    }</p>
  
  <p>private String  pageToDisplay = "welcome.xhtml";
  }</p></li>
  </ol>
  
  <p>When the page loads after logging in the default page set in the navigation bean is displayed but clicking on any link other than the log out link causes the default page to disappear from the center layout unit and a blank page is displayed/ Clicking on the log out link does log you out like intended though. ANy help would be greatly appreciated.</p>