OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Thymeleaf about th:block statement

  • Thread starter Thread starter StevePark
  • Start date Start date
S

StevePark

Guest
I'm trying to use th:block to make table more specific to analyze my data..

i was trying

Code:
<table>
   <thead>
      <tr>
       <th>something</tr>
       <th>something2</tr>
       <th>something3</tr>
      </tr>
   </thead>
   <tbody>
    <tr>
        <th:block th:if="${not #maps.isEmpty(result)}" th:each="firstEntry : ${result}">
           <th:block th:if="${firstEntryStat.count == 0}">
              <tr>
           </th:block>

           <td th:text="${firstEntry.value}"></td>

           <th:block th:if="${firstEntryStat.count == 0}">
              </tr>
           </th:block>
           
        </th:block>
   </tbody>
</table>

i attempted to make this kind of table (at the end of the post)

but it ends with the error which is

The element type "th:block" must be terminated by the matching end-tag "</th:block>"

so i tried another way,

Code:
 <table>
       <thead>
          <tr>
           <th>something</tr>
           <th>something2</tr>
           <th>something3</tr>
          </tr>
       </thead>
       <tbody>
        <tr>
            <th:block th:if="${not #maps.isEmpty(result)}" th:each="firstEntry : ${result}">
             <tr th:if="${firstEntryStat.count == 0}">

               <td th:text="${firstEntry.value}"></td>

             </tr th:if="${firstEntryStat.count == 0}">
               
            </th:block>
       </tbody>
    </table>

However, it produced the error like

The end-tag for element type "tr" must end with a '>' delimiter.

is there any way to make datatable like the picture above?

=================================================================== Additional Data Info My map data looks like

Code:
First
  - time
        now : slejflesf
        - past : lsijefleisf
        - future : lsajiefeasf
  - sleifj 
        - now : slejflesf
        - past : lsijefleisf
        - future : lsajiefeasf
Second
  - time
        - now : slejflesf
        - past : lsijefleisf
        - future : lsajiefeasf
  - sleifj 
        - now : slejflesf
        - past : lsijefleisf
        - future : lsajiefeasf




------------------------------------------------------
  Map Name  |  Sub Name  |  Now  |  Past  |  Future  |
------------------------------------------------------
  First     |    time    | asfas | lsefa  | saeflkjle|
            ------------------------------------------
            |    sleifj  | dsff  | sfesf  | sefasefa |
------------------------------------------------------
  Second    |    time    | asfas | lsefa  | saeflkjle|
            ------------------------------------------
            |    sleifj  | dsff  | sfesf  | sefasefa |
------------------------------------------------------
<p>I'm trying to use th:block to make table more specific to analyze my data..</p>
<p>i was trying</p>
<pre><code><table>
<thead>
<tr>
<th>something</tr>
<th>something2</tr>
<th>something3</tr>
</tr>
</thead>
<tbody>
<tr>
<th:block th:if="${not #maps.isEmpty(result)}" th:each="firstEntry : ${result}">
<th:block th:if="${firstEntryStat.count == 0}">
<tr>
</th:block>

<td th:text="${firstEntry.value}"></td>

<th:block th:if="${firstEntryStat.count == 0}">
</tr>
</th:block>

</th:block>
</tbody>
</table>
</code></pre>
<p>i attempted to make this kind of table (at the end of the post)</p>
<p>but it ends with the error which is</p>
<blockquote>
<p>The element type "th:block" must be terminated by the matching end-tag
"</th:block>"</p>
</blockquote>
<p>so i tried another way,</p>
<pre><code> <table>
<thead>
<tr>
<th>something</tr>
<th>something2</tr>
<th>something3</tr>
</tr>
</thead>
<tbody>
<tr>
<th:block th:if="${not #maps.isEmpty(result)}" th:each="firstEntry : ${result}">
<tr th:if="${firstEntryStat.count == 0}">

<td th:text="${firstEntry.value}"></td>

</tr th:if="${firstEntryStat.count == 0}">

</th:block>
</tbody>
</table>
</code></pre>
<p>However, it produced the error like</p>
<blockquote>
<p>The end-tag for element type "tr" must end with a '>' delimiter.</p>
</blockquote>
<p>is there any way to make datatable like the picture above?</p>
<p>===================================================================
Additional Data Info
My map data looks like</p>
<pre><code>First
- time
now : slejflesf
- past : lsijefleisf
- future : lsajiefeasf
- sleifj
- now : slejflesf
- past : lsijefleisf
- future : lsajiefeasf
Second
- time
- now : slejflesf
- past : lsijefleisf
- future : lsajiefeasf
- sleifj
- now : slejflesf
- past : lsijefleisf
- future : lsajiefeasf




------------------------------------------------------
Map Name | Sub Name | Now | Past | Future |
------------------------------------------------------
First | time | asfas | lsefa | saeflkjle|
------------------------------------------
| sleifj | dsff | sfesf | sefasefa |
------------------------------------------------------
Second | time | asfas | lsefa | saeflkjle|
------------------------------------------
| sleifj | dsff | sfesf | sefasefa |
------------------------------------------------------
</code></pre>
Continue reading...
 

Latest posts

Top