Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我怎样才能转到ThymalLeaf中th:文本的下一行?_Java_Spring_Spring Mvc_Spring Boot_Thymeleaf - Fatal编程技术网

Java 我怎样才能转到ThymalLeaf中th:文本的下一行?

Java 我怎样才能转到ThymalLeaf中th:文本的下一行?,java,spring,spring-mvc,spring-boot,thymeleaf,Java,Spring,Spring Mvc,Spring Boot,Thymeleaf,我遇到了一个关于“\n”或的问题,问题是我需要进入一个新行。我把它放在牢房里了。我得到的内容,但只是在一行,我希望一个推下的其他细胞内。我也看到了一些类似的话题,但它在我的案例中不起作用 这就是我得到的: 我应该如何管理它进入一个单元格内的下一行 叶代码: <tr> <td th:text="${user.id}">1</td> <td th:text="${user.getUsername()}">Hamdo</td> <

我遇到了一个关于“\n”或
的问题,问题是我需要进入一个新行。我把它放在牢房里了。我得到的内容,但只是在一行,我希望一个推下的其他细胞内。我也看到了一些类似的话题,但它在我的案例中不起作用

这就是我得到的:

我应该如何管理它进入一个单元格内的下一行

叶代码:

 <tr>

<td th:text="${user.id}">1</td>
<td th:text="${user.getUsername()}">Hamdo</td>
<span th:each="tweet : ${tweets}">
<td th:text="${tweet.content} " ><br/>
 <br/>
</td>
</span>
服务类别:

 private List<TweetDTO> tweetsFromUser(User user) {
return tweetRepository.findAllByAuthor(user).stream().map(TweetDTO::new).collect(toList());
}
私有列表tweetsFromUser(用户用户){
返回tweetRepository.findAllByAuthor(user.stream().map(tweedto::new.collect)(toList());
}

您不需要额外的跨度。。。只需在
中循环,如下所示:

<tr>
  <td th:text="${user.id}">1</td>
  <td th:text="${user.username}">Hamdo</td>
  <td>
    <p th:each="tweet : ${tweets}" th:text="${tweet.content}" />
  </td>
</tr>

1.
哈姆多


所以您想要的是在每个跨距之间添加一个分隔符?我希望它显示在单元格中,但在彼此下面。它不一定要跨越,它可以是其他的东西。我需要把它一个接一个地呈现出来。我现在将用图片更新它。
<tr>
  <td th:text="${user.id}">1</td>
  <td th:text="${user.username}">Hamdo</td>
  <td>
    <p th:each="tweet : ${tweets}" th:text="${tweet.content}" />
  </td>
</tr>