日期:2014-05-16 浏览次数:20494 次
早上起了个大早来解决服务器上JSP报错的问题。
页面提示如下:
?
HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 16 in the jsp file: /content/media_category.jsp Generated servlet error: Syntax error on token "<", invalid AssignmentOperator An error occurred at line: 16 in the jsp file: /content/media_category.jsp Generated servlet error: Syntax error on token "=", != expected org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397) org.apache.jasper.compiler.Compiler.compile(Compiler.java:288) org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) com.huilin.commons.filter.PrivilegeCheckFilter.doFilter(PrivilegeCheckFilter.java:123) com.huilin.commons.filter.CleanupDatabaseConnectioniFilter.doFilter(CleanupDatabaseConnectioniFilter.java:44) com.huilin.commons.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:122) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs. Apache Tomcat/5.5.9
?而第16行为 “<%” 和回车。即java代码的开头。就这么一个错误可算是折腾死我了。因为本地没有任何问题,只好google一下。找到 这篇文章?才恍然大悟,原来是范型出的问题。可是本地和服务器的jdk都是1.5.0_03,tomcat本地为5.5.26,服务器为5.5.9。不是版本问题。那就是配置了。这篇文章 中给出了配置问题,原来是JSP的问题。只好把范型都删掉了。
还出了个问题是: Long 型转换问题, setxxx(Long value) 这个方法,我在JSP中用 setxxx(Long.parseLong("123")) ,也是本地可以,服务器上不行。只好改成 new Long("123") 了。
?