问题描述
我有一个正在运行的Web应用程序,正在Tomcat 5.5上运行,试图将其移植到Tomcat7.在尝试使用Jasper2预编译某些JSP时遇到问题.我得到:java.lang.NumberFormatException:对于输入字符串:"$ {startYear}"
I've got a working webapp running on Tomcat 5.5 that I'm trying to port to Tomcat 7. I'm running into a problem when trying to precompile some JSPs with Jasper2. I get:java.lang.NumberFormatException: For input string: "${startYear}"
我认为问题在于,这个新版本的Jasper(JSP 2.1 impl)正在尝试在预编译期间取消引用$ {startYear}.使用旧版本时,我在生成的Java文件中看到$ {startYear}.
I believe the issue is that this new version of Jasper (JSP 2.1 impl) is trying to dereference ${startYear} during precompilation. With the older version I see ${startYear} in the generated Java file.
我确定这是我所缺少的一些配置或类路径问题,但是我找不到解决方案的任何良好链接.顺便说一句-我可以通过恢复到5.5附带的Jasper罐子来使其工作,但是如果我可以避免的话,我宁愿不这样做.
I'm sure this is some config or classpath issue I'm missing, but I can't find any good links to a solution. BTW - I can get it to work by reverting back to the Jasper jars that come with 5.5, but I'd rather not do that if I can avoid it.
感谢任何提示
推荐答案
好像您在Webapp的/WEB-INF/lib
中有一个悬挂的JSTL 1.0库. EL表达式的编译和评估方式不同.删除旧的JSTL 1.0 jstl.jar
和standard.jar
文件,然后放入新的JSTL 1.2 jstl-1.2.jar
文件.
Look like that you've a dangling JSTL 1.0 library around in your webapp's /WEB-INF/lib
. EL expressions are compiled and evaluated differently. Remove both the old JSTL 1.0 jstl.jar
and standard.jar
files and put a fresh new JSTL 1.2 jstl-1.2.jar
file in place.
不要忘记在任何JSP中更新JSTL taglib URI,以包括自JSTL 1.1以来引入的新/jsp
前缀.例如
Don't forget to update the JSTL taglib URIs in any JSP to include the new /jsp
prefix which was introduced since JSTL 1.1. E.g.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
这篇关于迁移到Tomcat 7的jasper/JSP预编译问题-NumberFormatException:对于输入字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!