Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
Spring mvc 通过集合中的集合循环_Spring Mvc_Thymeleaf - Fatal编程技术网

Spring mvc 通过集合中的集合循环

Spring mvc 通过集合中的集合循环,spring-mvc,thymeleaf,Spring Mvc,Thymeleaf,我需要循环到路线中的点集合中 我有这样的想法: <tr th:if="${routes!=null}" th:each="route : ${routes}"> <td><span th:text="${route?.name}"> name </span></td> <td><span th:text="${route?.pointsForRoute}"> poi

我需要循环到路线中的点集合中 我有这样的想法:

<tr th:if="${routes!=null}" th:each="route : ${routes}">
            <td><span th:text="${route?.name}"> name </span></td>
            <td><span th:text="${route?.pointsForRoute}"> pointsForRoute </span></td>
            <td><span th:text="${route?.routeLength}"> routeLength </span></td>
            <td><span th:text="${route?.heightDiffrence}"> heightDiffrence </span></td>
            <tr th:if="${route.points!=null}" th:each="point : {route?.points}">
            <td><span th:text="${point?.name}"> name </span></td>
        </tr>

名称
点箭头
路由长度
高度差
名称
我得到的原因是:org.thymeleaf.exceptions.TemplateProcessingException:无法作为每个点进行解析:“点:{route?.points}”(模板:“show routes”-第41行,第51列)

路线等级:

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
int id;

@Column(name="name")
String name;

@Column(name="points")
int pointsForRoute;

@Column(name="length")
double routeLength;

@Column(name="heightDiffrence")
int heightDiffrence;

@ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.MERGE, CascadeType.DETACH})
@JoinTable(name = "PunktyTrasy",
joinColumns = @JoinColumn(name="idT"),
inverseJoinColumns = @JoinColumn(name = "idP"))
private List<Point> points = new ArrayList<>();
@Id
@GeneratedValue(策略=GenerationType.IDENTITY)
int-id;
@列(name=“name”)
字符串名;
@列(name=“points”)
int点错误;
@列(name=“length”)
双路由长度;
@列(name=“heightdifference”)
内高度差;
@ManyToMany(fetch=FetchType.LAZY,cascade={CascadeType.REFRESH,CascadeType.PERSIST,CascadeType.MERGE,CascadeType.DETACH})
@JoinTable(name=“PunktyTrasy”,
joinColumns=@JoinColumn(name=“idT”),
inverseJoinColumns=@JoinColumn(name=“idP”))
私有列表点=新的ArrayList();

提前谢谢你的帮助

您在th:each=“point:{route?.points}中忘记了$ 因此,替换

th:each="point : {route?.points}"


请在thymeleaf页面上提供用于发送数据路由、点的控制器代码。点列表是否在路线列表中?正如我所看到的,你从DB中分别获取积分列表,在你的页面上,你正试图从路由列表中获取积分列表。!
th:each="point : ${route?.points}"