2017-03-21 4 views
0

ハッシュマップ内のキー内に値のリストを持つテンプレートを配置しようとしていますが、新しい行に単独で置き換えようとすると、テンプレートに入れようとします。HashMap内のリストのためのThymeleafフォーマット

画像: Problem Thymeleafコードの一部:

<div class="container"> 
    <h1 class="text-center">Boards</h1> 
    <hr /> 
    <table class="table table-striped"> 
     <tr> 
      <th>Board Name</th> 
      <th>Investor</th> 
      <th>Fuse Manufacturer</th> 
      <th>Fuse Nr. Of Poles</th> 
      <th>Fuse Characteritics</th> 
      <th>Fuse Amount</th> 
     </tr> 
     <th:block th:each="item, iterStat : ${map}" varStatus="status"> 
      <tr> 
       <td th:text="${item.key.name}"></td> 
       <td th:text="${item.key.investor}"></td> 
       <tr th:each="fuse : ${item.value}"> 
        <td th:text="${fuse.fuse.manufacturer.name}"></td> 
        <td th:text="${fuse.fuse.type}"></td> 
        <td th:text="${fuse.fuse.characteristics}"></td> 
        <td th:text="${fuse.quantity}"></td> 
       </tr> 
      </tr> 
     </th:block> 
    </table> 
</div> 
+0

あなたはアーカイブしたいものを記述するイメージを提供できますか? –

答えて

0

あなた<tr />秒で<tr />秒を作成しています。 thymeleafによって生成されたソースを見ると、これを伝える必要があります。私はあなたのhtmlが次のように見えるはずだと思います:

<table class="table table-striped"> 
    <tr> 
    <th>Board Name</th> 
    <th>Investor</th> 
    <th>Fuse Manufacturer</th> 
    <th>Fuse Nr. Of Poles</th> 
    <th>Fuse Characteritics</th> 
    <th>Fuse Amount</th> 
    </tr> 

    <th:block th:each="item: ${map}"> 
    <tr th:each="fuse: ${item.value}"> 
     <td th:text="${item.key.name}" /> 
     <td th:text="${item.key.investor}" /> 
     <td th:text="${fuse.fuse.manufacturer.name}" /> 
     <td th:text="${fuse.fuse.type}" /> 
     <td th:text="${fuse.fuse.characteristics}" /> 
     <td th:text="${fuse.quantity}" /> 
    </tr> 
    </th:block> 
</table> 
関連する問題