framework 提高开发效率的工具
对jdbc封装,对数据库的增删改查变得简单:mybatis, hibernate
对web开发封装,spring-mvc, struts2
处理请求参数 string
把这些框架整合在一起:spring(软件的黏合剂)
SSM -> spring-mvc, spring, mybatis(重点学习)
SSH -> strtus2, spring, hibernate
1. maven
辅助工具,管理软件中用到的jar包,以及jar包之间的依赖关系
apache出品
1.1 maven三要素
groupId 公司或组织的唯一标识
artifactId 项目的唯一标识
version 版本SNAPSHOT(快照版) RELEASE(发布版)
1.2 maven项目的目录结构
项目目录
|-src
|-main 正式代码
|-java java源码
|-resources 配置文件
|-test 测试代码
|-java 测试的java源码
|-resources 测试的配置文件
|-webapp
|-jsp
|-WEB-INF
|-css
|-js
pom.xml maven自身的配置文件
1.3 pom文件的功能
- 管理jar包
<!-- 依赖项 -->
<dependencies>
<dependency>
<groupId>jar的组织id</groupId>
<artifactId>jar的项目id</artifactId>
<version>版本</version>
</dependency>
</dependencies>
- 常见jar包依赖:
<!-- mysql 驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
<!-- 单元测试 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.5</version>
</dependency>
<!-- 开发web程序需要用到-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- 开发文件上传 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
- 互联网上有一个maven仓库(远程仓库)
在项目中用到jar包时,在本地仓库中找
第一次因为本机仓库没有,会联网到网上去下载这些jar包
下载后会把他们存入本地仓库 C:\Users\Administrator.m2\repository
可以配置一个局域网的远程仓库地址
C:\Users\Administrator.m2\settings.xml
把其中的ip地址部分修改为教师机的ip地址:192.168.10.240
如果在家里的环境将maven仓库地址
http://maven.aliyun.com/nexus/content/groups/public
国外仓库搜索地址:https://mvnrepository.com
ali仓库搜索地址:http://maven.aliyun.com/mvn/search