如何在jsp集合中列出<对象>

时间:2017-10-01 11:11:29

标签: spring-mvc collections

我有@oneToMany关系会员 - >电话。

@entity(会员)

private Collection<Phone> phonesById;

我尝试在表格中列出会员的电话。

<c:forEach items="${Members}" var="Member">
                <tr>
                    <td> ${Member.tcNo} </td>
                    <td> ${Member.name} ${Member.surname}</td>
                    <td> ${Member.mail} </td>
                    <td> ${Member.job} </td>
                    <td>
                        <table class="table table- table-hover table-advance">
                            <thead>
                              <c:forEach items="${Member.phonesById}" var="phone">
                                <tr>
                                  <td>
                                      ${phone.phone}
                                  </td>
                                </tr>
                              </c:forEach>
                            </thead>
                        </table>
                    </td>
                    <td>
                        <a href="${pageContext.request.contextPath}/member_update/${Member.id}"><button type="button" class="btn green-jungle">Güncelle</button></a>
                        <a href="${pageContext.request.contextPath}/member_delete/${Member.id}"><button type="button" class="btn red">Sil</button></a>
                    </td>
                </tr>
            </c:forEach>

错误:org.hibernate.LazyInitializationException:懒得初始化一个角色集合:com.cm.entity.Member.phonesById,无法初始化代理 - 没有会话

如何在jsp页面的表格中显示?

0 个答案:

没有答案