一.遇到的问题总结
- 添加"Maven Project 项目"时,报错
- "The superclass "javax.servlet.http.HttpServlet" was not found on the Java BuildPath"
- 解决方法:
- 在项目右击属性"properties"
- 选择"Java build path" --- > "Libraries"
- 选择"add Library" ---> server Runtime --- > "Apache Tomcat v8.0"
- 成功解决
- 处理警告信息
- 警告信息:
Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.- 解决方法
- 在pom.xml文件中添加以下代码
<!-- 编译工具的插件 --> <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>
maven创建web工程时,web.xml的3.1版本的约束
<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> </web-app>
二.实体类
1.区域类
2.商品类
3.店铺类
三.项目结构
- src/main/java java 的业务代码
- entity包 实体类
- web 包 control层 控制层
- dao包 数据库的操作,文件的读写,redies的缓存操作
- service包
- imple包 实现包
- enums包 枚举类型
- dto 包 弥补
- interceptor包 拦截器
- util包 通用工具类
- src/main/resources 项目所用到的资源文件,如:spring,mybaits,日志的配置文件
- src/main/resources/spring spring 文件
- src/main/resources/mapper DAO文件
- src/test/java 单元测试代码,
- src/test/resources 单元测试的配置文件
- Maven Dependencies Maven依赖,管理jar包,通过pom.xml配置文件指定下载
- src/main/webapp 前端的静态资源
- resources CSS,JS,Images
- WEB-INF 浏览就无法访问的目录
- web.xml 初始化配置信息
- target 创建Maven时生成的文件