随笔分类 -  springmvc

springmvc 之 异常处理
摘要:1. 在mvc 框架中经常需要处理异常,在spring中也提供了异常处理方式,统一映射,自定义处理器,通过注解来处理。 2. 处理中抛出异常: 配置文件: 阅读全文

posted @ 2017-05-04 10:12 forever_2h 阅读(108) 评论(0) 推荐(0)

springmvc 之 拦截器
摘要:1. 拦截器在 mvc 框架中,起到了重要的作用,比如权限的检查,登陆验证等功能。 2. 在springmvc 中拦截器的实现方式有两种:HandlerIntercepted 接口和继承HandleInterceptedAdaptor类。 3. 实现自定义拦截器步骤: 自定义拦截器: /** * 自 阅读全文

posted @ 2017-05-04 10:08 forever_2h 阅读(118) 评论(0) 推荐(0)

springmvc 之 ajax
摘要:1. 在springmvc 中依然可以使用 servletapi 来实现ajax的操作。 和 servlet 的时候一致。 2. 使用springmvc进行json数据的传递工作。 a) 需要导入jackson 的 jar 包 b) 编写处理器 c) 配置文件中使用: d) 页面 阅读全文

posted @ 2017-05-04 09:54 forever_2h 阅读(125) 评论(0) 推荐(0)

springmvc 之 文件上传
摘要:注意:servlet-mapping如果为 / 时,要拦截所要的请求。 请求路径不能和上传的目录一致 阅读全文

posted @ 2017-05-04 09:39 forever_2h 阅读(130) 评论(0) 推荐(0)

springmvc 之 url映射restful 及 ant
摘要:1. 传统的url :http://localhost:8080/usersys/delete.do?id=001 Restful : http://localhost:8080/usersys/001/delete.do 2. Restful : 表征状态转移。 3. Restful 的好处: 更 阅读全文

posted @ 2017-05-04 09:28 forever_2h 阅读(278) 评论(0) 推荐(0)

springmvc 之 处理方法的返回值类型
摘要:1. void: 并且没有使用servletapi进行跳转,那么默认会将请求名作为试图名进行跳转。 结果: void: 在参数中使用了servletapi,并且在方法中使用servletapi进行了跳转。那么按照servletapi跳转的位置进行跳转。 结果: 使用servletAPI跳转页面,那么 阅读全文

posted @ 2017-05-03 16:14 forever_2h 阅读(3395) 评论(0) 推荐(0)

springmvc 之 数据处理
摘要:1. 数据流入到处理类中 servletAPI可以自动注入到处理方法的属性上。 /** * ServletAPI可以通过方法的参数直接注入 * ServletAPI的包装类也可以直接注入 * @param req * @param wr * @return */ @RequestMapping("/ 阅读全文

posted @ 2017-05-03 15:29 forever_2h 阅读(275) 评论(0) 推荐(0)

springmvc 之 使用注解开发springmvc
摘要:1. controller映射的几种方式: BeanNameUrlHandlerMapping <!-- 配置handlerMapping --> <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMappi 阅读全文

posted @ 2017-05-03 14:53 forever_2h 阅读(1797) 评论(0) 推荐(0)

springmvc 之 配置及流程
摘要:发起请求 服务器接受 DispatcherServlet(前端控制器) 根据配置的HandlerMapping找到对应的处理器 获取适配器对象 调用处理器来进行处理 mv 试图解析器 响应 阅读全文

posted @ 2017-05-03 14:35 forever_2h 阅读(137) 评论(0) 推荐(0)

springmvc 之 springmvc简介,开发步骤
摘要:新建web项目 导入jar包 commons-logging-1.1.1.jar spring-aop-4.1.6.RELEASE.jar spring-aspects-4.1.6.RELEASE.jar spring-beans-4.1.6.RELEASE.jar spring-context-4 阅读全文

posted @ 2017-05-03 11:12 forever_2h 阅读(180) 评论(0) 推荐(0)

导航