随笔分类 -  Java框架 / SpringMVC

摘要:1.No converter found for return value of type: class java.util.ArrayList springmvc 默认是没有对象转换成json的转换器的 手动添加jackson依赖 <!-- jackson--> <dependency> <gro 阅读全文
posted @ 2023-02-21 18:50 lwx_R 阅读(19) 评论(0) 推荐(0) 编辑
摘要:1.文件上传 1.1 pom.xml <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.2</version> </dependenc 阅读全文
posted @ 2022-10-15 19:42 lwx_R 阅读(23) 评论(0) 推荐(0) 编辑
摘要:mvc配置文件 1.全部拦截 <!-- 使用bean定义一个Interceptor --> <mvc:interceptors> <!-- 直接定义在根下面的Interceptor拦截所有请求--> <bean class="org.xxx.springmvc.interceptors.inter1 阅读全文
posted @ 2022-10-13 13:02 lwx_R 阅读(43) 评论(0) 推荐(0) 编辑
摘要:@Controller public class ProductController { /** * 用于将Controller方法返回的对象,通过HttpMessageConverter转化为指定格式 * 写入到Response对象的body数据区 */ @RequestMapping("prod 阅读全文
posted @ 2022-10-13 12:52 lwx_R 阅读(12) 评论(0) 推荐(0) 编辑
摘要:@Controller public class ViewController { //页面重定向 @RequestMapping("v1") public String queryView1(){ return "redirect:v1.jsp?a=123"; } //中文乱码 @RequestM 阅读全文
posted @ 2022-10-13 12:51 lwx_R 阅读(20) 评论(0) 推荐(0) 编辑
摘要:1.ModelAndView @Controller public class HelloController { @RequestMapping("hell")//http://localhost:8080/hell.do public ModelAndView hello(){ ModelAnd 阅读全文
posted @ 2022-10-08 18:09 lwx_R 阅读(13) 评论(0) 推荐(0) 编辑
摘要:1.参数绑定定义 客户端请求的key/value数据 经过参数绑定,将其绑定到Controller的形参上,然后Controller直接使用该形参。 2.默认数据类型 HttpServletRequest HttpServletResponse HttpSession:HttpServletRequ 阅读全文
posted @ 2022-10-08 18:08 lwx_R 阅读(22) 评论(0) 推荐(0) 编辑
摘要:使用@RequestMapping注解 可以在类/方法上加 @Controller @RequestMapping("url")//http://localhost:8080/url/u01.do 类级别 public class UrlController { @RequestMapping("u 阅读全文
posted @ 2022-10-08 18:04 lwx_R 阅读(149) 评论(0) 推荐(0) 编辑
摘要:1.创建Maven的Web项目 2.pom.xml配置 <dependencies> <!-- spring web--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> 阅读全文
posted @ 2022-09-29 20:49 lwx_R 阅读(19) 评论(0) 推荐(0) 编辑
摘要:1.什么是SpringMVC Spring MVC是Spring家族中的一个web成员, 它是一种基于Java的实现了Web MVC设计思想的请求驱动类型的轻量级Web框架, 即使用了MVC架构模式的思想,将web层进行职责解耦,基于请求驱动指的就是使用请求-响应模型, 框架的目的就是帮助我们简化开 阅读全文
posted @ 2022-09-28 17:28 lwx_R 阅读(27) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示