摘要:在线springmvc_rest demo由于下一版本的rapid-framwork需要集成spring RESTful URL,所以研究了一下怎么搭建. 并碰到了一下问题。springmvc 3.0 中增加 RESTful URL功能,构造出类似javaeye现在的URL。rest介绍, 这里还有struts2 rest构造的一篇文章:使用 Struts 2 开发 RESTful 服务简单例子如下,比如如下URLJava代码/blog/1HTTPGET=>得到id=1的blog/blog/1HTTPDELETE=>删除id=1的blog/blog/1HTTPPUT=>更新i
阅读全文
随笔分类 - spring MVC3.0
spring MVC实践
摘要:上一篇我主要发了RESTful Web Services in Spring 3的服务端代码,这里我准备写客户端的代码。上篇得连接地址为:http://yangjizhong.iteye.com/blog/600540开始本篇了:注:附件里有源码,下载即可,依赖包请在spring网获得,谢谢。applicationContext.xml:Xml代码<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/bean
阅读全文
摘要:通过本文,我将介绍REST的特点,基本设计原则及其简单讲解,最后给出spring3.0下开发的RESTful Web Services 简单实例,其中许多内容是在网络上摘得,并通过自己理解写上的本人观点的博客,如有不同意见请指正。 REST(Representational State Transfer ),有中文翻译为"具象状态传输"(也有:"代表性状态传输")。是由 Roy Thomas Fielding博士 在2000年就读加州大学欧文分校期间在学术论文中提出的一个术语。他首次系统全面地阐述了REST的架构风格和设计思想。这篇论文是Web发展史上一
阅读全文
摘要:一、前言:大家好,Spring3 MVC是非常优秀的MVC框架,由其是在3.0版本发布后,现在有越来越多的团队选择了Spring3 MVC了。Spring3 MVC结构简单,应了那句话简单就是美,而且他强大不失灵活,性能也很优秀。官方的下载网址是:http://www.springsource.org/download (本文使用是的Spring 3.0.5版本)Struts2也是比较优秀的MVC构架,优点非常多比如良好的结构。但这里想说的是缺点,Struts2由于采用了值栈、OGNL表达式、struts2标签库等,会导致应用的性能下降。Struts2的多层拦截器、多实例action性能都很好
阅读全文
摘要:SpringMVC的拦截器不同于Spring的拦截器,SpringMVC具有统一的入口DispatcherServlet,所有的请求都通过DispatcherServlet,所以只需要在DispatcherServlet上做文章即可,DispatcherServlet也没有代理,同时SpringMVC管理的Controller也不有代理。 一、Servlet Filter与Spring interceptor的执行顺序 Filter有顺序吗?我们怎么控制filter的执行顺序。通过Tomcat的代码分析,servlet在Filter执行完成后才调用,如有多个filter怎么控制执行顺序,首先会
阅读全文
摘要:Spring MVC does special care to upload file to server. It makes file upload an easy work for web application developers. Spring MVC library jar provides CommonsMultipartResolver class that makes special care to form submitted using “multipart/form-data” encode type. We can also specify max file size
阅读全文
摘要:从2.0版本开始,如果使用JSP和Spring Web MVC的话,Spring提供了一套支持数据绑定的标签集合,用于处理表单元素。 每个标签所支持的属性集合和与其对应的HTML标签相同,这就让这些标签看起来很熟悉,而且用起来很直观。 由这些标签库生成的HTML页面符合HTML 4.01/XHTML 1.0标准。与其它表单/输入标签库不同,Spring的表单标签库与Spring Web MVC集成在一起, 使标签可以使用命令对象(command object)和你的控制器处理的参考数据(reference data)。 就像下面这些例子展示的一样,表单标签让JSP更易于开发、阅读和维护。让我们
阅读全文
摘要:一、前言:大家好,Spring3 MVC是非常优秀的MVC框架,由其是在3.0版本发布后,现在有越来越多的团队选择了Spring3 MVC了。Spring3 MVC结构简单,应了那句话简单就是美,而且他强大不失灵活,性能也很优秀。官方的下载网址是:http://www.springsource.org/download (本文使用是的Spring 3.0.5版本)Struts2也是比较优秀的MVC构架,优点非常多比如良好的结构。但这里想说的是缺点,Struts2由于采用了值栈、OGNL表达式、struts2标签库等,会导致应用的性能下降。Struts2的多层拦截器、多实例action性能都很好
阅读全文
摘要:简介:JSR 303 – Bean Validation 是一个数据验证的规范,2009 年 11 月确定最终方案。2009 年 12 月 Java EE 6 发布,Bean Validation 作为一个重要特性被包含其中。本文将对 Bean Validation 的主要功能进行介绍,并通过一些示例来演示如何在 Java 开发过程正确的使用 Bean Validation。关于 Bean Validation在任何时候,当你要处理一个应用程序的业务逻辑,数据校验是你必须要考虑和面对的事情。应用程序必须通过某种手段来确保输入进来的数据从语义上来讲是正确的。在通常的情况下,应用程序是分层的,不同
阅读全文
摘要:kaptcha 是一个非常实用的验证码生成工具。有了它,你可以生成各种样式的验证码,因为它是可配置的。kaptcha工作的原理是调用 com.google.code.kaptcha.servlet.KaptchaServlet,生成一个图片。同时将生成的验证码字符串放到 HttpSession中。使用kaptcha可以方便的配置:验证码的字体验证码字体的大小验证码字体的字体颜色验证码内容的范围(数字,字母,中文汉字!)验证码图片的大小,边框,边框粗细,边框颜色验证码的干扰线(可以自己继承com.google.code.kaptcha.NoiseProducer写一个自定义的干扰线)验证码的样式
阅读全文
摘要:关于Spring Web Services框架Spring web services(以下简称:Spring WS)框架是springframework东家SpringSource公司旗下的一个子项目。目前的版本是1.5M1,最新版本可以从spirngframework网站下载,项目地址是:http://www.springframework.org/node/567由于怀着对spring框架的热爱,于是打算学习下这个框架。Spring Web Services框架的特点Spring框架的支持,你可以重用Spring的所有特性。Spring WS使用Contract First(自顶向下)的设
阅读全文
摘要:In this tutorial we are create RegistrationForm in Spring 3.0. In this tutorial we are using annotation based Controller and another related files.Spring 3 MVC Registration Form ExampleIn this tutorial we are create RegistrationForm in Spring 3.0. In this tutorial we are using annotation based Contr
阅读全文
摘要:i am having trouble with binding my data from a form : I have two class@Entity @Table(name = "ROLES") public class Role implements GenericDomain { private Long id; private String code; private String name; private Set<Privilege> privileges = new HashSet<Privilege>(0); public Ro
阅读全文
摘要:In this tutorial we are going to create annotation based file upload example using Spring 3.0 MVC module.Spring 3 MVC File UploadCreating file upload example using Spring 3 MVCLearn how to create file upload application using Spring MVC module of the Spring 3 framework.In this tutorial we are going
阅读全文
摘要:@ResponseBody & @RequestBody作用?@RequestBody 将 HTTP 请求正文插入方法中,使用适合的HttpMessageConverter将请求体写入某个对象。@ResponseBody 将内容或对象作为 HTTP 响应正文返回,使用@ResponseBody将会跳过视图处理部分,而是调用适合HttpMessageConverter,将返回值写入输出流。HttpMessageConverter接口<mvc:annotation-driven />开启了之后它给AnnotationMethodHandlerAdapter初始化7个转换器,可以
阅读全文
摘要:以下内容是经过自己整理资料、官方文档所得:web.xml配置:<servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <description>加载/WEB-INF/spring-mvc/目录下的所有XML作为Spring MVC的配置文件</description> &
阅读全文
摘要:In lastSpring auto-wiring in XMLexample, it will autowired the matched property of any bean in current Spring container. In most cases, you may need autowired property in a particular bean only.In Spring, you can use@Autowiredannotation to auto wire bean on the setter method, constructor or a field.
阅读全文
摘要:packagecom.epeer.dao;publicinterfaceUserDao{publicvoidinsertUserIp(Stringstartip,Stringendip);}packagecom.epeer.dao;importjava.text.MessageFormat;importorg.springframework.jdbc.core.support.JdbcDaoSupport;publicclassUserDaoImplextendsJdbcDaoSupportimplementsUserDao{privatestaticfinalStringINSERT=&qu
阅读全文
摘要:Spring applicationContext.xml的<context:component-scan>標籤用途比我想像的還要實用。而且後來才知道,有了<context:component-scan>,另一個<context:annotation-config/>標籤根本可以移除掉,因為被包含進去了。原本我survery Spring3通常只配置成<context:component-scan base-package="com.foo.bar"/>,意即在base-package下尋找有@Component和@Confi
阅读全文
摘要:13.9.使用Spring的表单标签库 - Spring Framework reference 2.0.5 参考手册中文版13.9.使用Spring的表单标签库从2.0开始,Spring提供全面的,支持数据绑定的JSP标签来处理表单元素(如果你使用JSP和Spring的Web MVC框架的话)。 每个标签所支持的属性跟其对应的HTML标签相同,这样这些标签看起来就不陌生,而且很容易用。 由这些标签库生成的HTML页面符合HTML 4.01/XHTML 1.0标准。与其它的标签库不同,Spring的表单标签库和Spring Web MVC框架是集成在一起的,因此它们可以直接使用命令对象(com
阅读全文
浙公网安备 33010602011771号