网上大部分是spring3.0的传JSON对象,spring3自带了支持JSON对象。
关于spring2.5,也很简单。导入两个jackson的jar包,然后手动传json对象
jackson-core-asl-1.9.11.jar jackson-mapper-asl-1.9.11.jar
原来controller里面传ModelAndView:
public ModelAndView test(HttpServletRequest req, HttpServletResponse res) throws Exception { return new ModelAndView(view, model); }
改成传json对象
public ModelAndView test(HttpServletRequest req, HttpServletResponse res) throws Exception { ObjectMapper mapper = new ObjectMapper(); res.getOutputStream().print(mapper.writeValueAsString(dinnerList)); res.getOutputStream().flush(); res.getOutputStream().close(); // res.getOutputStream().write(new String("No parameter found.").getBytes()); return null; }
相关推荐
真正可以使用的 spring mvc 2.5.6 国际化 实例 internationalization example 实际eclipse工程,包含jar包。 http://localhost:8080/welcome.htm
spring2.5+strust1+hibernate3.0JAR包集合
spring 2.5依赖包
spring-framework-2.5.6.SEC02 和 源码 每天进步一点点
spring framework 2.5.6的源码. ...Version 2.5.6 is the sixth update release in the Spring 2.5 series. It contains many bug fixes, along with upgrades and minor enhancements throughout the framework
spring2.5jar包.zip
解决“annotation-config are only available on JDK 1.5 and higher”的问题!
spring-webmvc-2.5.6.jar,集成hession使用
一、Spring MVC环境搭建:(Spring 2.5.6 + Hibernate 3.2.0) 1. jar包引入 Spring 2.5.6:spring.jar、spring-webmvc.jar、commons-logging.jar、cglib-nodep-2.1_3.jar Hibernate 3.6.8:hibernate3.jar...
spring2.5.6.zip包括spring2.5.6所有jar包为
Spring2.5+Quartz定时任务简单例子web工程 myeclipse 项目开发的,可直接导入运行
spring-bean-2.5.6.jar spring-context-2.5.6.jar spring-core-2.5.6.jar spring-web-2.5.6.jar
基于 Spring2.5.6 包含Spring2.5中的信赖注入、AOP、事务管理等较全面的内部。
文档太大,分成了两个部分,这是第二部分,和第一部分spring-framework-2.5.6-I合在一起就是完整版
spring-framework-2.5.6.SEC01-with-dependencies: 由于有60M的限制,使用Free-File-Splitter-v5.0.1189(http://www.filesplitter.org)工具分割为两个文件。这是第一个文件。 下载2个文件后,请用这个工具的...
spring2.5.6相关依赖jar包,包含完整的依赖包
spring2.5基于注解的例子程序,包含相关jar包
NULL 博文链接:https://yinhe2726.iteye.com/blog/1192466