${items.id} 解析成字符串,不解析成变量

一、问题

1、前端jsp片段

 <table width="100%" border="1">
        <tr>
            <td>商品ID</td>
            <td>商品介绍</td>
            <td>商品名称</td>
            <td>操作</td>
        </tr>
        <c:forEach items="${itemlistKey}" var="items">
            <tr>
                <td>${items.id}</td>
                <td>${items.js}</td>
                <td>${items.mc}</td>
                <td><a href="${pageContext.request.contextPath}/item/editItem.action?id=${items.id}">修改</a> </td>
            </tr>
        </c:forEach>
    </table>

显示页面(火狐浏览器):
这里写图片描述
也就是foreach 根本没解析后台传过来的变量;

二;解决办法
jsp中加入

<%@ page isELIgnored="false"%>

三、讨论isELIgnored 作用

<%@ page isELIgnored=”true|false”%>

如果设定为真,那么JSP中的表达式被当成字符串处理。比如下面这个表达式<p>{2000 % 20}</p>在isELIgnored="true"时输出为 {2000 % 20}</p>在isELIgnored="true"时输出为 {2000 % 20},而isELIgnored=”false”时输出为100。
注意:有的web浏览器默认为true(firefox),有的默认为false

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值