Resource specification not allowed here for source level below 1.7 博客分类: javajava技巧
现象:tomcat能正常启动,但打开页面时,出现上面的错误。
原因:就是jsp编译的版本不对。
因为tomcat7默认jsp的编译级别为1.6
1.解决方法:
工程名右键属性-java里设置jdk为1.7.
2.解决方法:
修改conf/web.xml
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.7</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.7</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>