title: JSF - Load different forms based on mimetype values in DataTable using AJAX call
body: <p>For one of my projects, I need to load different forms based on mimetype values available in DataTable components. I have header, content - DataTable in the middle and data display in the footer. Click on DataTable entry should load data on footer based on mimetype values. For example mimetype - text will call text bean and load the content, mimetype - pdf will call pdf bean and pdf plug in and so on. </p>
  
  <p>Right now, I am able to display only one mimetype contents in single jsf page. I need to achieve this in single jsf page. Could anybody sends some inputs ? </p>
  
  <p>Here is the sample code I am using - for text</p>
  
  <pre><code>&lt;h:form id="form1"&gt;
      &lt;h:dataTable value="#{info.office.programmers}" var="programmer"&gt;
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;Report Name&lt;/f:facet&gt;
                  &lt;h:commandLink id="reportName"  value="#{programmer.reportName}"&gt;
                      &lt;f:param name="RID" value="#{programmer.reportName}" /&gt;
                      &lt;f:param name="mime" value="#{programmer.mimeType}" /&gt;
                      &lt;f:ajax render=":form2"/&gt;
                  &lt;/h:commandLink&gt;
          &lt;/h:column&gt;
          &lt;h:column&gt;
              &lt;f:facet name="header"&gt;Mime Type&lt;/f:facet&gt;
              &lt;h:commandLink id="mimeType"  value="#{programmer.mimeType}"&gt;
                  &lt;f:param name="RID" value="#{programmer.reportName}" /&gt;
                  &lt;f:param name="mime" value="#{programmer.mimeType}" /&gt;
                  &lt;f:ajax render=":form2"/&gt;
              &lt;/h:commandLink&gt;
          &lt;/h:column&gt;
      &lt;/h:dataTable&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Clicking on dataTable with mimetype="text" link will call <code>Text.xhtml</code> and display text data.</p>
  
  <pre><code>&lt;h:form id="form2"&gt;
      &lt;ui:include src="Text.xhtml"/&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Click on DataTable with mimetype="pdf" will call this form2</p>
  
  <pre><code>&lt;h:form id="form2"&gt;
      &lt;object data="/&lt;directory&gt;/DisplayPdf.jsf" type="application/pdf" width="100%" height="100%"&gt;
  &lt;/h:form&gt;
  </code></pre>