简体   繁体   English

在JSF 1.2中使用数据表显示按行数据

[英]To Display row wise data using datatable in JSF 1.2

<h:dataTable var="data" value="mBean.dataList">
 <h:column>
  <f:facet name="header">
   <h:outputText value="Name">
  </f:facet>
  <h:outputText value="#{data.name}"/>
   </h:column>
   <h:column>
    <f:facet name="header">
     <h:outputText value="Description">
    </f:facet>
   <h:outputText value="#{data.description}"/>
   </h:column>
</h:dataTable>

The above code would fetch the result like this : 上面的代码将获取如下结果:

Name Decription N1 D1 N2 D2 N3 D3 N4 D4 名称说明N1 D1 N2 D2 N3 D3 N4 D4

But I want the data to be displayed as : N1 D1 但我希望数据显示为:N1 D1

N2 D2 N2 D2

N3 D3 N3 D3

N4 D4 N4 D4

Plz let me know how to achieve the above requirement. 请让我知道如何达到上述要求。 Thanks in advance. 提前致谢。

the structure you posted is correct, but: 您发布的结构正确,但是:

every Tag have to be closed. 每个标签都必须关闭。 in your code you have many <h:outputText value="..."> without closing tag. 在您的代码中,有许多<h:outputText value="...">没有结束标记。 correct it and it should work 纠正它,它应该可以工作

Its too late but finally we got one solution on this quetion below I am writting some code so you can use it as example. 为时已晚,但是最终我们在下面的问题上找到了一个解决方案,我正在编写一些代码,以便您可以将其用作示例。

 <h:dataTable var="data" value="mBean.dataList">
 <h:column> 
 <h:panalGrid column="2"> 
<f:facet name="header"> 
 <h:outputText value="Name">  
</f:facet>  
<h:outputText value="#{data.name}"/>  
</h:panalGrid>  <h:panalGrid column="2">    
<f:facet name="header">     
<h:outputText value="Description">   
 </f:facet> 
e var="data" value="mBean.dataList"><h:outputText value="#{data.description}"/>   
</h:panalGrid>   
</h:column>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM