1-1 序章
- 技术储备:
- 掌握Java Web基础和Maven构建项目
- 掌握Spring框架的基础知识
- 环境准备:
- JDK8
- Chrome
- Maven3.3.9
- Tomcat8
- MySQL5.5+
- Eclipse
1-2 开发准备& 1-3 Eclipse与maven的联合配置
1.new maven project
2.next选择webapp项目工程
3.next
4.报错
解决:右键项目==》properties==》Java Build Path==》Add Library==》Server RunTime==》Apache Tomcat v8.5==》Finish
5.在pom.xml文件中添加maven-compiler-plugin插件
<build>
<finalName>o2o</finalName>
<plugins>
<plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF8</encoding>
</configuration>
</plugin>
</plugins>
</build>
6.new test resources folder
右键项目==》properties==》Java Build Path==》Source==》Add Folder...==>test/resources==>修改Output folder:
7.修改动态网页模型版本,更高的版本对于解析JS等元素有着更高的效率
8.修改web.xml设置默认web项目默认访问页面
<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>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
9.启动tomcat,访问http://localhost:8080/o2o/