java - Why datatable adds more <td> to my table -


this jsf:

 <h:datatable class="pretty" value="#{ftcontroller.ftdatamodel}" var="item">                     <h:column>                         <f:facet name="header">                             <h:outputtext value="amount"/>                         </f:facet>                     </h:column>                     <h:column >                         <f:facet class="right" name="header">                             <h:outputtext value="date"/>                         </f:facet>                     </h:column>                     <h:column>                               <h:outputlink   value="index.jsf"><h:outputtext value="#{item.fttype}"/></h:outputlink><br />                           <h:outputtext class="red" id="amount"   value="#{item.amount}"></h:outputtext> <h:outputtext value="&#160;" /><h:outputtext  style="font-size:12px" class="gray" value="tl" />                     </h:column>                     <h:column class="right" >                         <h:outputtext id="date"    value="#{item.date}"></h:outputtext>                      </h:column>                 </h:datatable> 

howerver, html output that:

<table class="pretty"> <thead> <tr> <th scope="col">amount</th> <th scope="col">date</th> <th scope="col"></th> <th scope="col"></th> </tr> </thead> <tbody> <tr> <td></td> <td></td> <td><a href="index.jsf" class="ui-link">person</a><br><span id="j_idt8:j_idt21:0:amount" class="red">34500.6</span>&nbsp;<span class="gray" style="font-size:12px">tl</span></td> <td><span id="j_idt8:j_idt21:0:date">10/14/2012</span></td> </tr> <tr> <td></td> <td></td> <td><a href="index.jsf" class="ui-link">person</a><br><span id="j_idt8:j_idt21:1:amount" class="red">3444.78</span>&nbsp;<span class="gray" style="font-size:12px">tl</span></td> <td><span id="j_idt8:j_idt21:1:date">10/15/2012</span></td> </tr> </tbody> </table> 

it adds <th> ex under amount , date. , adds <td>s why? problem here? how can solve it? why adds?

just nest <f:facet> within <h:column> together row data. telled jsf in code create 4 columns, first 2 have empty row data , defined header text , following 2 have reversed. fix like:

            <h:datatable class="pretty" value="#{ftcontroller.ftdatamodel}" var="item">                 <h:column>                     <f:facet name="header">                         <h:outputtext value="amount"/>                     </f:facet>                     <h:outputlink   value="index.jsf"><h:outputtext value="#{item.fttype}"/></h:outputlink><br />                       <h:outputtext class="red" id="amount"   value="#{item.amount}"></h:outputtext> <h:outputtext value="&#160;" /><h:outputtext  style="font-size:12px" class="gray" value="tl" />                 </h:column>                 <h:column >                     <f:facet class="right" name="header">                         <h:outputtext value="date"/>                     </f:facet>                     <h:outputtext id="date"    value="#{item.date}"></h:outputtext>                  </h:column>             </h:datatable> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -