随笔分类 -  springMVC

Spring重定向
摘要:1.使用HttpServletResponse的sendRedirect()方法。 示例: 2.返回"redirect:"加上url。 注意:这种方式,不能使用@RestController和@ResponseBody,否则只会返回一堆字符串。 如下: 参考资料: https://blog.csdn 阅读全文

posted @ 2019-05-27 23:04 乐之者v 阅读(501) 评论(0) 推荐(0) 编辑

含有Date属性的对象转化为Json
摘要:含有Date类型属性的对象,转化为Json,Date属性并不是时间戳格式。 解决方法: 使用Jackson的注解@JsonFormat,添加到对象属性上方即可。 我们的北京时间会相差8个小时,因为我们是东八区(北京时间)。所以我们在格式化的时候要指定时区(timezone )。 Jackson的依赖 阅读全文

posted @ 2019-04-20 22:09 乐之者v 阅读(1524) 评论(0) 推荐(0) 编辑

SpringMvc配置拦截器
摘要:SpringMVC可以通过配置拦截器,进行url过滤等处理。 在spring-mvc.xml的配置文件中,如下示: 其中,在<mvc:interceptors>中可以配置多个拦截器<mvc:interceptor>。 然后添加拦截器类,拦截器主要是通过继承HandlerInterceptorAdap 阅读全文

posted @ 2018-07-12 11:02 乐之者v 阅读(263) 评论(0) 推荐(0) 编辑

springmvc 请求无法到达controller,出现404
摘要:今天在配置SpringMVC时,访问项目一直出现404,无法访问。 报错: The origin server did not find a current representation for the target resource or is not willing to disclose th 阅读全文

posted @ 2018-07-09 15:59 乐之者v 阅读(10353) 评论(0) 推荐(0) 编辑

forward内部跳转 和redirect重定向跳转的区别 ?
摘要:1.从地址栏显示来说forward是服务器请求资源,服务器直接访问目标地址的URL,把那个URL的响应内容读取过来,然后把这些内容再发给浏览器.浏览器根本不知道服务器发送的内容从哪里来的,所以它的地址栏还是原来的地址.redirect是服务端根据逻辑,发送一个状态码,告诉浏览器重新去请求那个地址.所 阅读全文

posted @ 2018-06-07 16:55 乐之者v 阅读(285) 评论(0) 推荐(0) 编辑

SpringMvc配置
摘要:第一:加载web.xml之后,读哪个配置文件?即是applicationContext-mvc.xml还是xxx-servlet.xml? 解答:①在web.xml中配置DispatcherServlet时, <servlet> <servlet-name>dispatch</servlet-nam 阅读全文

posted @ 2018-06-01 16:53 乐之者v 阅读(157) 评论(0) 推荐(0) 编辑

IntelliJ Idea解决Could not autowire. No beans of 'xxxx' type found的错误提示
摘要:原文地址:https://blog.csdn.net/u012453843/article/details/54906905 1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示。但程序的 阅读全文

posted @ 2018-05-04 17:04 乐之者v 阅读(25523) 评论(0) 推荐(0) 编辑

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
摘要:参考博客:http://www.cnblogs.com/feiyujun/p/6537510.html 阅读全文

posted @ 2018-04-20 10:37 乐之者v 阅读(269) 评论(0) 推荐(0) 编辑

NoSuchBeanDefinitionException:No qualifying bean of type found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.
摘要:报错如下: NoSuchBeanDefinitionException:No qualifying bean of type found for dependency: expected at least 1 bean which qualifies as autowire candidate fo 阅读全文

posted @ 2018-04-17 17:43 乐之者v 阅读(909) 评论(0) 推荐(0) 编辑

关于Url传递参数
摘要:Url传递参数时,后台取值会直接取等号后面的内容,包括引号在内。 比如: http://localhost:8080/user?name='admin' 这是错误的做法,后台获取到的参数是包括引号在内的'admin',并不是admin 如果想在Url中传递参数,无须加上引号,直接传内容就可以了。 比 阅读全文

posted @ 2018-03-14 11:33 乐之者v 阅读(400) 评论(0) 推荐(0) 编辑

SpringMVC上传文件的MultipartFile源码
摘要:零.MultipartFile上传文件的具体实例如下: http://blog.csdn.net/swingpyzf/article/details/20230865 一.具体类和方法 上传文件主要方法是transferTo(),可以将某个文件复制保存到新的路径中。 Multipart接口的实现类C 阅读全文

posted @ 2017-11-08 15:36 乐之者v 阅读(4407) 评论(0) 推荐(0) 编辑

SpringMVC总结
摘要:Spring MVC框架一、SpringMVC运行步骤:1.DispatcherServlet接收客户端的请求;2.DispatcherServlet使用HandlerMapping查找负责处理该请求的Controller处理器3.DispatcherServlet将请求分发给对应的Controll 阅读全文

posted @ 2017-08-25 14:18 乐之者v 阅读(202) 评论(0) 推荐(0) 编辑

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

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