下面的例子。
https://www.primefaces.org/showcase/ui/data/datatable/basic.xhtml
我想在数据表中添加前缀。如何添加?
电流输出
Id Year Brand Color
1c859c99 1985 Honda Maroon
37143be3 1993 Ford Red
4cd0ff68 1985 Volvo Black
8f12cce2 1963 Audi White
预期输出
Id Year Brand Color
1c859c99 1985 Car Honda Maroon
37143be3 1993 Car Ford Red
4cd0ff68 1985 Car Volvo Black
8f12cce2 1963 Car Audi White
<p:dataTable var="car" value="#{dtBasicView.cars}">
<p:column headerText="Id">
<h:outputText value="#{car.id}" />
</p:column>
<p:column headerText="Brand">
<h:outputText value="#{car.brand}" />
</p:column>
</p:dataTable>
<p:column headerText="Brand">
<h:outputText Car?? value="#{car.brand}" />
</p:column>
任你挑选。
<p:column headerText="Brand">
<h:outputText value="Car #{car.brand}" />
</p:column>
<p:column headerText="Brand">
Car <h:outputText value="#{car.brand}" />
</p:column>
<p:column headerText="Brand">
<h:outputText value="Car" /> <h:outputText value="#{car.brand}" />
</p:column>
<p:column headerText="Brand">
<h:outputText value="Car" /> #{car.brand}
</p:column>
<p:column headerText="Brand">
Car #{car.brand}
</p:column>
他们都一样好。
另请参阅:
- 是否建议对所有内容使用h:outputText