MyBatis
1. 简介 原名叫ibatis 底层是对JDBC封装 数据访问层框架 2. 使用 配置文件 context.xml 放在MATE-INF目录 负责配置数据库以及数据库连接池 可以将鼠标悬停在标签上,可以看到标签的相应语法,?表示0个或一个,顺序也得遵守 事务回滚 一般操作一个session 只要session没关闭 之前的所有执行的sql都是一个事…
683
|
|
|
2020-1-03 13:51
|
2020-1-03 13:55
548 字
|
5 分钟
JUnit-单元测试的简单使用
1. 安装JUnit File-->settings-->Plguins-->Browse repositories-->输入JUnit-->选择JUnit Generator V2.0安装 2. 配置test文件夹 3. 使用 import org.junit.Test; public class TestJUnit…
519
|
|
|
2020-1-03 11:27
|
2020-1-03 11:27
30 字
|
1 分钟内
2.实现增删查改
1. 目录 2. mapper public interface UsersMapper { void insertUser(Users uses); int deleateUser(int id); List<Users> selectAllUser(); Users findUser(int id); int updateUser(…
481
|
|
|
2020-1-02 0:10
|
2020-1-02 0:10
181 字
|
9 分钟
1.建立项目
1. pom.xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.20.RELEASE…
595
|
|
|
2020-1-01 22:11
|
2020-1-01 22:38
82 字
|
4 分钟
4.实现 HandlerExceptionResolver 接口处理异常
1. 介绍 优点:实现简单,可以注入异常信息到页面 2. 实现 @Configuration public class GlobalException1 implements HandlerExceptionResolver{ @Override public ModelAndView resolveException(HttpServletReq…
556
|
|
|
2020-1-01 21:35
|
2020-1-01 21:37
47 字
|
2 分钟
3.配置 SimpleMapingExceptionResolver 处理异常
1.介绍 @Configuration启动容器 @Bean注册Bean 缺点:无法注入异常信息到页面 2.实现 @Configuration public class GlobalException1 { @Bean public SimpleMappingExceptionResolver getSimpleMappingExceptionRes…
504
|
|
|
2020-1-01 21:25
|
2020-1-01 21:25
46 字
|
1 分钟内
2.使用@ControllerAdvice+@ExceptionHandler 注解处理异常
1.介绍 建立一个专门负责处理异常的类 缺点:实现过程复杂 2.实现 @ControllerAdvice public class GlobalException { @ExceptionHandler(value={java.lang.ArithmeticException.class}) public ModelAndView arithmet…
671
|
|
|
2020-1-01 21:11
|
2020-1-01 21:36
53 字
|
2 分钟
1.自定义错误页面
1.SpringBot 默认的处理异常的机制 一旦程序中出现了异常,SpringBoot会向/error的url发送请求。在 springBot 中提供了一个叫BasicExceptionController 来处理/error 请求,然后跳转到默认显示异常的页面来展示异常信息。 2.修改默认页面 在src/main/resources/templ…
604
|
|
|
2020-1-01 20:49
|
2020-1-01 20:49
186 字
|
1 分钟内
5.Url表达式-thymeleaf
th:href <a th:href="@{http://www.baidu.com}">绝对路径</a><br/> <a th:href="@{/show5}">相对路径,相对于当前项目的根,相对于项目的上下文的相对路径</a><br/> <a th:href="@{~…
594
|
|
|
2020-1-01 16:19
|
2024-2-01 17:02
17 字
|
1 分钟内
4.域对象操作-thymeleaf
1.request 对应的接口:javax.servlet.http.HttpServletRequest 概念:只在一次请求上(转发不算请求,因为转发是服务器端的行为)生效,当把信息返回给客户端,该对象就被摧毁 2.session 对应的接口 :javax.servlet.http.HttpSession 概念:是服务器端的行为用于跟踪客户的状态…
586
|
|
|
2020-1-01 15:12
|
2020-1-01 15:20
270 字
|
2 分钟