title: Load xhtml in p:panels-primefaces
body: <p>I have a question.
  How do I load a new xhtml file to p:panel using a button and still change the url. I would like to use a command button to load a new xhtml file to p:panel but i still want the websites url to change.</p>
  
  <p><strong>Why I want to do this.</strong></p>
  
  <p>I want to do this because i want my website to have multiple pages with my toolbar in each page. I don't want to have to duplicate the code for my toolbar in each page. -dose that make sense? If anyone know how to help please let me know.</p>
  
  <p><strong>My code. index.xhtml</strong></p>
  
  <p>Scroll done till you find p:panel with the class value "ClassPanel"
  When a button in my toolbar is clicked i would like the p:panel to load a new xhtml file.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"  
        xmlns:h="http://java.sun.com/jsf/html"  
        xmlns:f="http://java.sun.com/jsf/core"  
        xmlns:p="http://primefaces.org/ui" 
         xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
  
      &lt;h:head&gt;
         &lt;title&gt;LEEXV&lt;/title&gt;
  
      &lt;/h:head&gt;
  
      &lt;h:body&gt;
          &lt;style&gt;
  
          &lt;/style&gt;
  
          &lt;h:form &gt; 
  
              &lt;p:growl id="messages"/&gt;
  
              &lt;p:toolbar id="stickymenu" style=" max-height:60px; margin-top: auto; "&gt;
                  &lt;f:facet name="left"&gt;
  
                       &lt;f:facet name="left"&gt;
  
  
  
                  &lt;/f:facet&gt;
  
              &lt;f:facet name="right"&gt;
                  &lt;p:growl id="growl" life="2000"/&gt;
                  &lt;p:inputText  style="margin-right:40px;" placeholder="Search Crawly"/&gt;
                  &lt;p:spacer width="10px;"/&gt;
  
                       &lt;p:commandButton value="Ajax Action" action="#{navigationView.gotoSecond}" style=" width: 90px; height: 40px;"/&gt; 
  
                  &lt;p:spacer width="20px;"  /&gt;
                  &lt;p:commandButton id="Support" type="ComButton" style=" width: 90px; height: 40px;" value="Donate"/&gt;
                  &lt;p:tooltip id="toolTipGrow" for="Support" value="Find out how you can help us help you!"
                             showEffect="clip" hideEffect="explode"  /&gt;
  
                  &lt;p:spacer width="20px;"/&gt;
                  &lt;p:commandButton type="ComButton" style=" width: 90px; height: 40px;"  value="Update"/&gt;
                  &lt;p:spacer width="20px;"/&gt;
                  &lt;p:commandButton type="ComButton"   style="width: 90px; height: 40px; margin-top: 6px;"  value="Shop"/&gt;
  
  
              &lt;/f:facet&gt;
  
  
  
  
                  &lt;/f:facet&gt;
  
  
                  &lt;f:facet name="right"&gt;
  
  
                  &lt;/f:facet&gt;
  
  
              &lt;/p:toolbar&gt;
  
  
              &lt;p:sticky target="stickymenu"/&gt;
          &lt;/h:form&gt;
  
  
  
          &lt;p:panel class="ClassPanel" &gt;
          &lt;ui:composition id="LoadNewpages"&gt; 
             &lt;ui:param id ="" name="defaultHeader"  value="#{HomeHtml.gotoSecond}" /&gt;
        &lt;/ui:composition&gt; 
  
  
              &lt;/p:panel&gt;
  
  
      &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>My code. newjsf.xhtml</strong></p>
  
  <p>This is the code i would like to load in the panel.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"   
     xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns="http://www.w3.org/1999/xhtml"  
  
        xmlns:f="http://java.sun.com/jsf/core"  
  
        xmlns:h="http://xmlns.jcp.org/jsf/html"&gt;
      &lt;body&gt;
          &lt;h:outputText value="hello"/&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>My code. NavigationView.java</strong></p>
  
  <pre><code>import java.io.Serializable;
   import javax.faces.bean.ManagedBean;
  @ManagedBean
  public class NavigationView implements Serializable {
  
      public String gotoSecond() {
          return "newjsf";
      }
  }
  </code></pre>
  
  <p><strong>If you don't understand please just try and help me with this part.. I have a history of asking bad question</strong></p>
  
  <p>How do i use a button to load xhtml files. 
  Basically, how do i load xhtml file dynamically to p:panel. </p>