javax.el.PropertyNotFoundException: Property 'id' not found on type java.lang.String

页面代码如下:

<tbody id="tb">
<c:forEach items="productTypes" var="productType">
    <tr>
        <td>${productType.id}</td>
        <td>${productType.name}</td>
        <td>
            <c:if test="${productType.status == 1}">禁用</c:if>
            <c:if test="${productType.status == 0}">启用</c:if>
        </td>
        <td class="text-center">
            <input type="button" class="btn btn-warning btn-sm doProTypeModify" value="修改">
            <input type="button" class="btn btn-danger btn-sm doProTypeDisable" value="禁用">
        </td>
    </tr>
</c:forEach>
</tbody>


报错信息:

SEVERE: Servlet.service() for servlet jsp threw exception
javax.el.PropertyNotFoundException: Property 'id' not found on type java.lang.String
at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:229)
at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:206)
at javax.el.BeanELResolver.property(BeanELResolver.java:317)

at javax.el.BeanELResolver.getValue(BeanELResolver.java:85)


找了半天,眼都花了,一直执著地在循环处找错误。最后发现,开头的地方就错了,

<c:forEach items="productTypes" var="productType">

这一句,items="productTypes"改成这样:items="${productTypes}"才正确,确实是看了一天电脑,眼睛不行了,脑子也不行了!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值