在eclipse中用maven创建web项目。
环境配置
C:\Users\xxx>java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
C:\Users\xxx>mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: C:\apache-maven-3.3.9\bin\..
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: C:\Java\jdk1.8.0_121\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
Eclipse Java EE IDE for Web Developers.
Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600
创建maven project
输入必要信息后,点Finish
编码改成UTF-8,然后点击OK
删除JRE 1.5
加入JRE 1.8依赖
编译级别改为1.8
设置project facets
在Java Build Path中删除无用依赖
在Java Build Path中加入Server Runtime依赖
建个JSP
运行
访问 http://localhost/model/index.jsp