目前还不知道怎么解决,待更新。。。
环境
jdk-13.0.2
tomcat 7
idea IntelliJ IDEA 2019.3.4 x64
大概知道是tomcat和jdk版本号不匹配的原因。
name首先从tomcat官网找一下tomcat的版本吧
tomcat官网
找到一张版本映射图
The mapping between the specifications and the respective Apache Tomcat versions is:
找到了一句貌似关键的话:
If the new Java version introduces new language features then the default JSP compiler may not support them immediately. Switching the JSP compiler to javac may enable these new language features to be used in JSPs.
翻译:就是如果新的java版本推出了新的语言特性,而默认的JSP编译器不会马上就能支持他们。。。
整了半天,我把jdk换成了1.8 然后baidu了一下,按照官网给的表,tomcat6是支持jdk5,并且向后兼容没错,但在maven中,tomcat6与jdk1.8就是不兼容的,把tomcat6换成tomcat7就万事大吉了。附上在pom.xml配置tomcat7的代码:
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
这样,maven配置的tomcat就能解析jsp了。