2014-02-26 47 views
0

對不起我的英文不好。表格創建出錯

即時消息新的jsp/servlet調用。最近我在jsp中創建了一個表來顯示從servlet請求的輸出。該servlet將該列表傳遞給jsp包含3個字段:日期,轉碼和金額爲1個月,並按日期分組。

下面

是我想要做的顯示:

date  | revcode | revcode | revcode and so on | total 
2013-02-02 | amount | amount | amount and so on | sum of the amount for that day 

這裏是我的代碼:

<table class="table table-bordered table-striped table-hover"> 
         <thead> 
         <th> Date </th> 
         <c:forEach var="revcodes" items="${revcodeList}"> 
         <th>${revcodes.revcode}</th> 
         </c:forEach> 
         <!--<th> Total </th>--> 
         </thead> 

         <tr> 
          <td></td> 
          <c:forEach var="revcodeAmount" items="${revcodeList}"> 
           <td>${revcodeAmount.amount}</td> 
          </c:forEach> 

         </tr> 
        </table> 

我不知道如何創建一個表像我上面想。你們能否指引我朝着正確的方向前進?或者我需要使用其他開源API作爲表格記錄像碧玉報告這樣做?

這裏是我的截圖鏈接:http://postimg.org/image/62ajljtcn/

+0

嘗試運行該代碼時是否收到任何錯誤消息? – CodeMed

+0

@CodeMed,迄今爲止。但它不顯示,因爲我想它是。 –

+0

您可以匿名發佈打印屏幕,方法是將其上傳到http://postimage.org/,然後將該網址放入發佈中的'img'標籤。這可以幫助人們看到你不喜歡的東西。 – CodeMed

回答

1

我認爲它可以工作:

<table class="table table-bordered table-striped table-hover"> 
<thead> 
    <th> Date </th> 
    <th> Total </th> 
</thead> 
<c:forEach var="revcodes" items="${revcodeList}"> 
    <tr> 
     <td>${revcodes.revcode}</td> 
     <td>${revcodeAmount.amount}</td> 
    </tr> 
</c:forEach> 
</table> 

你也可以使用DisplayTag還顯示錶格數據骨材這個LIB的幫助,並有選擇導出數據。

+0

將顯示每一行的revcode,我發佈了一些關於我之前想要的內容 –

+0

這裏是截圖鏈接:http://postimg.org/image/62ajljtcn/ –

+0

你的表有什麼問題? –