通过数据表蒲公英将嵌套列添加到 jstl 报告
Adding nested columns to jstl report by datatables dandelion
我正在使用蒲公英来显示 table(来自休眠数据库):
<datatables:table id="listPersons" data="${listPersons}" row="person"
cellspacing="0" width="100%"
theme="bootstrap2" pageable="true" info="true">
<datatables:column title="Person" property="person"/>
<datatables:column title="Car" property="car"/>
</datatables:table>
它工作正常。
但是,我需要从 Parents class (hibernate DB) 添加额外的两列:"Father name" 和 Mother name”。
class(也休眠)有变量:Parents parents;
我试过类似的方法:
<c:forEach items="${person.parents}" var="parents">
<datatables:column title="Father name" property="parents.father_name"/>
</c:forEach>
但我遇到了异常:
javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.NoSuchMethodException: Unknown property 'father_name' on class 'class org.hibernate.collection.internal.PersistentBag'
我尝试了多种变体(使用蒲公英数据table),但没有人奏效。
你应该改为
<datatables:column title="Father name">
<c:forEach items="${person.parents}" var="parent">
<c:out value="${parent.father_name}"/>
</c:forEach>
</datatables:column>
您遇到的问题是 property="parents.father_name"/>
没有使用您在 forEach 中设置的变量,而是使用 属性 来自作为集合的休眠实体
我正在使用蒲公英来显示 table(来自休眠数据库):
<datatables:table id="listPersons" data="${listPersons}" row="person"
cellspacing="0" width="100%"
theme="bootstrap2" pageable="true" info="true">
<datatables:column title="Person" property="person"/>
<datatables:column title="Car" property="car"/>
</datatables:table>
它工作正常。
但是,我需要从 Parents class (hibernate DB) 添加额外的两列:"Father name" 和 Mother name”。
class(也休眠)有变量:Parents parents;
我试过类似的方法:
<c:forEach items="${person.parents}" var="parents">
<datatables:column title="Father name" property="parents.father_name"/>
</c:forEach>
但我遇到了异常:
javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.NoSuchMethodException: Unknown property 'father_name' on class 'class org.hibernate.collection.internal.PersistentBag'
我尝试了多种变体(使用蒲公英数据table),但没有人奏效。
你应该改为
<datatables:column title="Father name">
<c:forEach items="${person.parents}" var="parent">
<c:out value="${parent.father_name}"/>
</c:forEach>
</datatables:column>
您遇到的问题是 property="parents.father_name"/>
没有使用您在 forEach 中设置的变量,而是使用 属性 来自作为集合的休眠实体