评估主体时出现JspException [英] JspException when evaluating the body

查看:117
本文介绍了评估主体时出现JspException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Currently, I got an issue relating to use tag in JSP file with SpringMVC. if I used checkbox type as manually, it run correctly

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

但是当我代替上面的方法使用时,它通知评估主体时出现JspException"

But when I used instead of the above, It informed " JspException when evaluating the body"

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

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

The below is detail of issue which the system informed:

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文件

and the below is jsp file which I used

<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>

请告诉我原因,以及如何解决此问题. 谢谢.

Please tell me know the reason for this and how to solve this case. Thanks.

推荐答案

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

I assume you are trying to bind the field to a property named listProductCompare of the model object backing your form. If so then that what you need is this.

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

不是

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

这篇关于评估主体时出现JspException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆