shop--1.创建maven项目
加入运行时所需要的包
j2se-1.5 但是用的jdk是1.8所以在pom.xml中的<bulid></bulid>中加入 <plugins> <plugin> //http://mvnrepository.com/search?q=maven-compiler-plugin 要把denpendency去掉 <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> //然后指明使用的源等信息 <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF8</encoding> </configuration> </plugin> </plugins>
接着建包
保证输出的在一个folder下
改动相关配置
其中改Dynamic Web Module
需要在项目目录下更改
<?xml version="1.0" encoding="UTF-8"?> <faceted-project> <fixed facet="wst.jsdt.web"/> <installed facet="wst.jsdt.web" version="1.0"/> <installed facet="java" version="1.8"/> <installed facet="jst.web" version="3.1"/> </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"> <display-name>Archetype Created Web Application</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app>
访问index.html 即可