JSP文件中的Lambda表达式将无法编译 [英] Lambda expressions in JSP files will not compile
问题描述
我已经尝试了关于stackoverflow的大多数建议,但是还没有找到解决方案.我遇到的错误如下.
I've tried most of the suggestions mentioned on stackoverflow but haven't come across a solution yet. The error I'm being presented with is the following.
An error occurred at line: 379 in the jsp file: /application-new-project_process.jsp
Lambda expressions are allowed only at source level 1.8 or above
我正在使用 IntelliJ IDEA 2016.2 ,并且已经应用了这些设置.
I'm using IntelliJ IDEA 2016.2 and have applied these settings.
Project Structure
→Project
,Project SDK
至1.8 (java version "1.8.0_102")
Project Structure
→Project
,Project Language Level
至8.0 - Lambdas, type annotations etc.
Settings
→Build, Execution, Deployment
→Compiler
→Java Compiler
,Project bytecode version
至1.8
Settings
→Build, Execution, Deployment
→Compiler
→Java Compiler
,Target bytecode version
至1.8
我正在使用 Tomcat v8.0.36 ,并且对JSP servlet具有以下要求.
I'm using Tomcat v8.0.36 and have the following for JSP servlets.
<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>compiler</param-name>
<param-value>modern</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>suppressSmap</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
任何建议将不胜感激!
推荐答案
我使用IntelliJ IDEA 2016.3.2,tomcat apache-tomcat-8.5.8,以下更改对我来说足够了:
1.更改以下文件:apache-tomcat-8.5.8 \ conf \ web.xml
2.修改
I use IntelliJ IDEA 2016.3.2, tomcat apache-tomcat-8.5.8, following changes are sufficient for me:
1. Change following file: apache-tomcat-8.5.8\conf\web.xml
2. Modify configuration for
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
-
添加以下初始化参数:
Add following init params:
< init-param>
< param-name> compilerSourceVM</param-name>
< param-value> 1.8</param-value>
</init-param>
< init-param>
< param-name> compilerTargetVM</param-name>
< param-value> 1.8</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.8</param-value>
</init-param>
完成.
这篇关于JSP文件中的Lambda表达式将无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!