C标签中使用El表达式需注意的问题

来源:互联网 发布:淘宝差评后可以退货吗 编辑:程序博客网 时间:2024/05/20 11:27

JSP中的C标签使用EL表达式时,如果EL表达式中有使用双引号需要改成单引号,否则报错。
如:

<c:forEach items="${fn:split(product.image,";")}" var="temp" begin="0" end="${fn:length(fn:split(product.image,";"))}" varStatus="tempsta">                                <li><img class="${tempsta.first?'bdorange':'bdgrey' }" src="${temp}"/></li>                            </c:forEach>

以上代码会报c标签解析错误,需要将el中的双引号改成单引号:

<c:forEach items="${fn:split(product.image,';')}" var="temp" begin="0" end="${fn:length(fn:split(product.image,';'))}" varStatus="tempsta">                                <li><img class="${tempsta.first?'bdorange':'bdgrey' }" src="${temp}"/></li>                            </c:forEach>
0 0
原创粉丝点击