评估主体时出现JspException

评估主体时出现JspException

当前,我遇到一个与SpringMVC在JSP文件中使用标签有关的问题。
如果我手动使用复选框类型,则它可以正常运行

<input type="checkbox"
                            value="${id}" name="${listCompare}" />


但是当我使用上面的方法时,它告知“评估主体时出现JspException”

td><form:checkbox path="${listCompare}" value="${id}"/></td>


以下是系统通知的问题的详细信息:


HTTP ERROR 500

Problem accessing /web/top.product. Reason:JspException when evaluating the body

Caused by:

java.io.IOException: JspException when evaluating the body
    at org.apache.tiles.request.jsp.autotag.JspModelBody.evaluate(JspModelBody.java:64)
    at org.apache.tiles.autotag.core.runtime.AbstractModelBody.evaluateWithoutWriting(AbstractModelBody.java:77)
    at org.apache.tiles.template.InsertDefinitionModel.execute(InsertDefinitionModel.java:97)
    at org.apache.tiles.jsp.taglib.InsertDefinitionTag.doTag(InsertDefinitionTag.java:254)
    at org.apache.jsp.jsp.user_page_top_rank_jsp._jspx_meth_tiles_insertDefinition_0(org.apache.jsp.jsp.user_page_top_rank_jsp:117)
    at org.apache.jsp.jsp.user_page_top_rank_jsp._jspService(org.apache.jsp.jsp.user_page_top_rank_jsp:89)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1221)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet


下面是我使用的jsp文件

<tiles:insertDefinition name="dataTemplate">
<tiles:putAttribute name="body">
    <!--End topicpath-box-->
    <div class="primary">
        <div class="menutabbar">
            <div class="title-sp">
                <p>
                    <a href="#">'${title}'.</a>
                </p>
            </div>

            <!--End tab-list-->
        </div>
        <!--End menutabbar-->
        <form:form method="GET" action="detail.compare">
            <table>
                <tr class="row-head">
                    <td class="col-head1 c1">#</td>
                    <td class="col-head1 c2">Bank</td>
                    <td class="col-head1 c6 text-center">ProductName</td>
                    <td class="col-head1 c7 text-center">ProductType</td>
                    <td class="col-head1 c4 text-center">Term</td>
                    <td class="col-head1 c5 text-center">Rate</td>
                    <td class="col-head1 c8"><a href="" type="submit"><img
                            src="resources/images/icon-so-sanh.png"
                            title="CompareDetail)"
                            alt="icon-so-sanh" /></a></td>
                </tr>
                <c:forEach items="${pageItems}" var="item" varStatus="loop">
                    <tr class="row-head2">
                        <td class="col-head2 c1">${loop.index + 1}</td>
                        <td class="col-head2 c2"><a href="${item.product.url}"><img
                                src="resources/logos/${fn:toLowerCase(item.product.bName)}.png"
                                alt="${item.product.bName}" /></a></td>
                        <td class="col-head2 c3 text-left"><c:choose>
                                <c:when test="${item.product.typeName != null}">
                                    ${item.product.typeName}
                            </c:when>
                                <c:otherwise>
                                    <c:forEach items="${item.types}" var="type" varStatus="loop">
                                        <c:if test="${type.key == item.product.productType}">
                                            ${type.value}
                                    </c:if>
                                    </c:forEach>
                                </c:otherwise>
                            </c:choose></td>
                        <td class="col-head2 c7 text-left"><a href="#"
                            ng-click="openDetailProduct('${item.product.id}','${item.term.id}')"
                            class="name-product"> ${item.product.name}</a> <span
                            class="date-product"><br />(Cập nhật: <fmt:formatDate
                                    value="${item.product.updated}" pattern="dd/MM/yyyy" />)</span></td>
                        <td class="col-head2 c4 text-center">${item.term.value}
                            ${item.term.label}</td>
                        <td class="col-head2 c5 text-center">${item.term.rate}%</td>
                        <%--<td class="col-head2 c8 checkbox"><form:checkbox
                                path="${listProductCompare}" value="${item.product.id}" /></td>--%>
                        <%-- <td class="col-head2 c8 checkbox"><input type="checkbox"
                            value="${item.product.id}" name="${listProductCompare}" /> <label
                            for="${listProductCompare}"></label></td>   --%>
                        <td><form:checkbox path="${listProductCompare}" value="${item.product.id}"/></td>
                    </tr>
                </c:forEach>
                <tr>
                    <td colspan="3" class="ss-buttom"><input type="submit"
                        value="Submit" /></td>
                    <td colspan="7" align="right" class="ss-buttom"><a href="#"
                        CompareDetail</a></td>
                </tr>
            </table>
        </form:form>
    </div>
</tiles:putAttribute>




请告诉我知道这种情况的原因以及如何解决此问题。
谢谢。

最佳答案

我假设您正在尝试将字段绑定到支持表单的模型对象的名为listProductCompare的属性。如果是这样,那么您所需要的就是这个。

<form:checkbox path="listProductCompare" value="${item.product.id}"/>


并不是

<form:checkbox path="${listProductCompare}" value="${item.product.id}"/>

09-10 14:46