Maven專案改web.xml版本
阿新 • • 發佈:2018-11-10
1.新建Maven專案後再pom.xml配置servlet_api包
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.zhang</groupId> <artifactId>struts2</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>struts2 Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>4.0.0</version> <scope>provided</scope> </dependency> </dependencies> <build> <finalName>struts2</finalName> </build> </project>
2.然後進web.xml裡面把類容改成你要改的版本的
修改前
我這裡是改成4.0版本的
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0"> </web-app>
3.修改jre版本:改成1.8
4.然後右鍵專案進入properties然後找到Project Facets
ba
把java的版本1.5改為1.8
然後把Dynamic Web Module 的√去掉然後改為4.0版本然後點Apply
然後把Dynamic Web Module 的√勾上
然後點中間這個框下面這條英文 Further conFiguration acailable
點ok然後應用就修改成功了