1、RESTful简介 REST:Representational State Transfer,表现层资源状态转移。 a>资源 资源是一种看待服务器的方式,即,将服务器看作是由很多离散的资源组成。每个资源是服务器上一个可命名的抽象概念。因为资源是一个抽象的概念,所以它不仅仅能代表服务器文件系统中的一个文件、数据库中的一张表等等具体的东西,可以将资…
pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http:…
pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http:…
SpringMVC中的视图是View接口,视图的作用渲染数据,将模型Model中的数据展示给用户 SpringMVC视图的种类很多,默认有转发视图和重定向视图 当工程引入jstl的依赖,转发视图会自动转换为JstlView 若使用的视图技术为Thymeleaf,在SpringMVC的配置文件中配置了Thymeleaf的视图解析器,由此视图解析器解析…
如果遇到el表达式不生效(原样输出问题不被解析)问题,比如${yanggb}被原样输出成字符串,通常的原因是servlet3.0默认关闭了el表达式的解析,因此jsp页面忽视了el标签,要加入不忽略el表达式的page指令才行。 <%@ page isELIgnored="false" %> 注:EL表达式是不需要引入包的,tomcat…
pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http:…
1、使用ServletAPI向request域对象共享数据 @RequestMapping("/testServletAPI") public String testServletAPI(HttpServletRequest request){ request.setAttribute("testScope", "hello,servletAPI"…
pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http:…
1、通过ServletAPI获取 将HttpServletRequest作为控制器方法的形参,此时HttpServletRequest类型的参数表示封装了当前请求的请求报文的对象 @RequestMapping("/testParam") public String testParam(HttpServletRequest request){ St…
pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http:…
1、@RequestMapping注解的功能 从注解名称上我们可以看到,@RequestMapping注解的作用就是将请求和处理请求的控制器方法关联起来,建立映射关系。 SpringMVC 接收到指定的请求,就会来找到在映射关系中对应的控制器方法来处理这个请求。 2、@RequestMapping注解的位置 @RequestMapping标识一个类…
这篇文章没有摘要
pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http:…
1、开发环境 IDE:idea 2022.3 构建工具:maven 3.8.1 服务器:tomcat 8.5.84 Spring版本:5.3.1 2、创建maven工程 a>添加web模块 b>打包方式:war c>引入依赖 <dependencies> <!-- SpringMVC --> <dep…
一、SpringMVC简介 1、什么是MVC MVC是一种软件架构的思想,将软件按照模型、视图、控制器来划分 M:Model,模型层,指工程中的JavaBean,作用是处理数据 JavaBean分为两类: 一类称为实体类Bean:专门存储业务数据的,如 Student、User 等一类称为业务处理 Bean:指 Service 或 Dao 对象,专…
1. 错误描述 2. 解决: STEP1: Ctrl+shit+alt+s 按住Ctrl+shit+alt+s本地安装的是jdk11,所以此处改为jdk11下面的 Project 和 module 都检查一下 STEP2: 继续ctrl+shift+s,或直接去File里找Settings打开,在打开的页面中找到Build开头的…
这篇文章没有摘要
Spring5 框架新功能(Webflux)
Log4j – Download Apache Log4j™ 2 需要使用到的包 slf4j-api-1.7.30.jar下载
Spring5 框架新功能 1、整个 Spring5 框架的代码基于 Java8,运行时兼容 JDK9,许多不建议使用的类和方法在代码库中删除 2、Spring 5.0 框架自带了通用的日志封装(1)Spring5 已经移除 Log4jConfigListener,官方建议使用 Log4j2(2)Spring5 框架整合 Log4j2 第一步 引入…