JSP 中无法使用EL表达式 原因

Hello to all from Spain

Well, my problem is:

I use JSP, LE and a tag library called "Pager Tag Library".
I have a .jsp page with this:

<c:set var="varbool" value="false"/>

<pg:pager items="<%= varNumFilas.intValue() %>"
url="consultatit.do"
index="center"
maxPageItems="5"
maxIndexPages="5"
isOffset="${varbool}"
export="offset,currentPageNumber=pageNumber"
scope="request">

This code works well. No problem. But with...

<c:set var="varNumFilas" value="15"/>
<c:set var="maxpages" value="5"/>

<pg:pager items="${varNumFilas}"
url="consultatit.do"
index="center"
maxPageItems="5"
maxIndexPages="${maxpages}"
isOffset="false"
export="offset,currentPageNumber=pageNumber"
scope="request">

I get an error:

java.lang.NumberFormatException: For input string: "${varNumFilas}"
java.lang.NumberFormatException.forInputString(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.valueOf(Unknown Source)
org.apache.jasper.compiler.JspUtil.coerceToInt(JspUtil.java:796)
...

Always, with any variable...

That is to say, when the required value of the attribute is numeric there is an error, and when the required value is not numeric (an String) there is not an error... ?Why?

Thanks to all


_______________
solve:

So the question is, what server/JSP spec are you using?

If you are using Tomcat 5.x or JSP2.0 spec, then you get EL evaluated outide of JSTL tags by adding:


<%@ page isELIgnored="false" %>


At the the top of the page.

If you are using an older version of Tomcat, or a server that does not support JSP 2.0, then you will have to re-write the Page Tags to be able to translate EL for you, or not use EL...
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值