title: Trying to change <ui:include> src tag dynamically
body: <p>I have main page that looks like this:</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.or/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:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.prime.com.tr/ui"&gt;
  &lt;h:head&gt;
      &lt;title&gt;Facelet Title&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;h:form&gt;
          &lt;p:panel id="panel"&gt;
              &lt;ui:include src="#{bean.page}"&gt;
              &lt;/ui:include&gt;
          &lt;/p:panel&gt;
          &lt;p:commandButton actionListener="#{bean.changePage}" value="Push" ajax="true" update="panel"/&gt;
      &lt;/h:form&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>What I want to do is have a bean like this and change dynamically which page is included. This is how bean looks like:</p>
  
  <pre><code> @ManagedBean
   @SessionScoped
   public class Bean {
      private String page = "";
  
      public Bean() {
      }
  
      public String getPage() {
         return page;
      }
  
      public void setPage(String page) {
         this.page = page;
      }
  
      public void changePage(ActionEvent e) {
         page = "Page.xhtml";
      }   
  }
  </code></pre>
  
  <p>When I click button Push I want this page to be included:</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:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
     &lt;h:head&gt;
         &lt;title&gt;Facelet Title&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;h:form&gt;
          &lt;ui:component&gt;
              Hello from facelets
          &lt;/ui:component&gt;
      &lt;/h:form&gt;
  &lt;/h:body&gt;
  </code></pre>
  
  <p></p>
  
  <p>Problem is that I have to press the button twice for page to be included. How can this be done so when I press the button the first time page is included?</p>