2021年12月9日

SpringMvc - 文件上传与下载

摘要: 文件上传 1.导入文件上传的jar包,commons-fileupload <!--文件上传--> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <vers 阅读全文

posted @ 2021-12-09 22:51 每天积极向上 阅读(86) 评论(0) 推荐(0) 编辑

SpringMvc - 返回JSON数据

摘要: 引入依赖 <!--fastjson start--> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.78</version> </dependency> <!--f 阅读全文

posted @ 2021-12-09 22:34 每天积极向上 阅读(175) 评论(0) 推荐(0) 编辑

SpringMvc - HttpMessageConverter

摘要: HttpMessageConverter,报文信息转换器,将请求报文转换为Java对象,或将Java对象转换为响应报 文 HttpMessageConverter提供了两个注解和两个类型: @RequestBody,RequestEntity @ResponseBody, ResponseEntit 阅读全文

posted @ 2021-12-09 22:27 每天积极向上 阅读(48) 评论(0) 推荐(0) 编辑

SpringMvc - HiddenHttpMethodFilter(application.xml)

摘要: 浏览器form表单只支持GET与POST请求,而DELETE、PUT等method并不支持,spring3.0添加了一个过滤器,可以将这些请求转换为标准的http方法。 HiddenHttpMethodFilter的父类是OncePerRequestFilter,它继承了父类的doFilterInt 阅读全文

posted @ 2021-12-09 21:56 每天积极向上 阅读(89) 评论(0) 推荐(0) 编辑

SpringMvc - 视图控制器(application.xml)

摘要: 当控制器方法中,仅仅用来实现页面跳转,即只需要设置视图名称时,可以将处理器方法使用view-controller标签进行表示 <!-- path:设置处理的请求地址 view-name:设置请求地址所对应的视图名称 --> <mvc:view-controller path="/" view-nam 阅读全文

posted @ 2021-12-09 21:36 每天积极向上 阅读(126) 评论(0) 推荐(0) 编辑

SpringMvc - 请求重定向与请求转发

摘要: 请求转发: 请求转发,即request.getRequestDispatcher().forward(),是一种服务器的行为,客户端只有一次请求,服务器端转发后会将请求对象保存,地址栏中的URL地址不会改变,得到响应后服务器端再将响应发给客户端; 请求重定向: 请求重定向,即response.sen 阅读全文

posted @ 2021-12-09 21:20 每天积极向上 阅读(225) 评论(0) 推荐(0) 编辑

SpringMvc - Request域,Session域,Application域共享对象

摘要: Request域 1、使用ServletAPI向request域对象共享数据 @RequestMapping("/testServletAPI") public String testServletAPI(HttpServletRequest request){ request.setAttribu 阅读全文

posted @ 2021-12-09 18:22 每天积极向上 阅读(158) 评论(0) 推荐(0) 编辑

SpringMvc - 绑定参数

摘要: 实体类自动绑定参数 实体类自动绑定参数 @RequestMapping("/xxx") public String method(User user){ . . . . } class User { private String name; private int age; private doub 阅读全文

posted @ 2021-12-09 17:49 每天积极向上 阅读(51) 评论(0) 推荐(0) 编辑

springMvc - @PathVariable

摘要: @PathVariable:接收请求路径中占位符的值 @RequestMapping(value="/Test/{id}") public void Test(@PathVariable("id") Integer id){ ............. } 阅读全文

posted @ 2021-12-09 17:22 每天积极向上 阅读(25) 评论(0) 推荐(0) 编辑

SpringMvc - @RequestMapping属性详解

摘要: @Target({ElementType.METHOD, ElementType.TYPE}) // 可以在方法和类的声明中使用 @Retention(RetentionPolicy.RUNTIME) @Documented @Mapping public @interface RequestMap 阅读全文

posted @ 2021-12-09 17:09 每天积极向上 阅读(161) 评论(0) 推荐(0) 编辑

SpringMvc - springmvc-servlet.xml

摘要: springmvc-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2 阅读全文

posted @ 2021-12-09 16:49 每天积极向上 阅读(33) 评论(0) 推荐(0) 编辑

SpringMvc - 目录

摘要: Spring MVC概述:Spring MVC是Spring提供的一个强大而灵活的web框架。借助于注解,Spring MVC提供了几乎是POJO的开发模式,使得控制器的开发和测试更加简单。这些控制器一般不直接处理请求,而是将其委托给Spring上下文中的其他bean,通过Spring的依赖注入功能 阅读全文

posted @ 2021-12-09 16:32 每天积极向上 阅读(122) 评论(0) 推荐(0) 编辑

SpringMvc - 导入的包以及配置文件

摘要: 1.要导入的包 pom.xml <!--版本控制--> <properties> <spring.version>5.3.13</spring.version> </properties> <dependencies> <!--spring mvc start--> <dependency> <gr 阅读全文

posted @ 2021-12-09 16:25 每天积极向上 阅读(417) 评论(0) 推荐(0) 编辑

导航