JSF HTML表显示列值动态总计

时间:2019-11-14 04:52:55

标签: jsf

我在下面的HTML表格中填充了product。我想使用jsf facelet标签在table th标签中动态计算并显示产品价格列总计。

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:components="http://java.sun.com/jsf/composite/components"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      >         

    <table class="count-tbl">
                                <tr class="count-tbl-tr">
                                    <th class="count-tbl-th bg-green">productid</th>
                                    <th class="count-tbl-th bg-green">name</th>
                                    <th class="count-tbl-th bg-green">price</th>
                                </tr>
                                <ui:repeat var="product" value="#{homeController.productDetails}" varStatus="status">
                                    <tr class="count-tbl-tr">
                                        <td class="count-tbl-td">#{product.productId}</td>
                                        <td class="count-tbl-td">#{product.name}</td>
                                        <td class="count-tbl-td">#{product.price}</td>
                                    </tr>
                                </ui:repeat>
                                <tr class="count-tbl-tr">
                                    <th class="count-tbl-th bg-light-blue">Total</th>
                                    <th class="count-tbl-th bg-light-blue">**<<<price Total>>**</th>

                                </tr>
                            </table>

0 个答案:

没有答案