【问题标题】:JSF Add prefix to output text in datatableJSF 为数据表中的输出文本添加前缀
【发布时间】:2020-11-16 17:52:55
【问题描述】:

我正在按照下面的示例进行操作。

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>

【问题讨论】:

    标签: jsf


    【解决方案1】:

    任你选。

    <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>
    

    它们都一样好。

    另见:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-13
      • 1970-01-01
      • 2018-11-10
      • 2013-11-18
      相关资源
      最近更新 更多