Dynamic Web Module 3.1版本对于解析js以及页面DOM元素效率会更高,由于Eclipse的小bug在设置改版本时会报错,所以曲线救国,换一种方式解决该问题:
在本地该项目路径下 –> 双击.settings文件夹 –> 打开org.eclipse.wst.common.project.facet.core.xml文件,
设置如下:
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.1"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
同时将web.xml文件头也做相应修改:
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1" metadata-complete="true">
<display-name>Archetype Created Web Application</display-name>
</web-app>
并设置pom.xml文件:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
最后,右击项目选择Maven –> Update Project –> OK即可。