@RequestMapping(value = "/loadMenu", method = RequestMethod.GET)
@ResponseBody
public ArrayList<TreeNode> loadMenu(@RequestParam(value = "node") String nodeId) throws Exception {
ArrayList<TreeNode> nodes = new ArrayList<TreeNode>();
if (TreeNode.ROOT.equals(nodeId)) {
TreeNode node = new TreeNode();
node.setObjectId("12345");
node.setText("root");
node.setLeaf(false);
nodes.add(node);
} else {
TreeNode node = new TreeNode();
node.setObjectId("23456");
node.setText("1");
node.setLeaf(true);
nodes.add(node);
}
return nodes;
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:annotation-config />
<context:component-scan base-package="com" /> <bean id="json"
class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="json" />
</list>
</property>
</bean> </beans>

jar : jackson-core-asl-1.9.13.jar ; jackson-mapper-asl-1.9.13.jar  1.9.0 包太旧会报找不到class的错

Ajax请求SpringMVC的更多相关文章

  1. 解决ajax请求(SpringMVC后台)响应415/400/405错误

    解决ajax请求(SpringMVC后台)响应415/400/405错误 后端代码 bean public class user { private String username; private ...

  2. 使用ajax请求SpringMVC返回Json出现乱码解决方法

    1:在使用ajax请求后台访问数据的数据,后台返回的数据是乱码,带??问号的乱码,之前还一直没有遇到过,在这里记录整理一下,贴出解决代码! (1):前台使用ajax ,已经设定返回的结果为json格式 ...

  3. http 500 Internal Server Error的错误 ajax请求SpringMVC后台中返回500 Internal Server Error

    使用httprequester接口测试能返回数据,但是用ajax返回json格式的时候返回报500Internal Server Error. The server encountered an in ...

  4. SpringMVC下Ajax请求的方法,@Responsebody如果返回的是布尔值,ajax不会接到任何回传数据

    SpringMVC框架下,如果用ajax向后台请求得方法如果使用@Responsebody返回布尔值的话,ajax得不到任何的回传数据. 但是如果返回String类型,就是正常的. 测试了下代码写得没 ...

  5. Ajax发送POST请求SpringMVC页面跳转失败

    问题描述:因为使用的是SpringMVC框架,所以想使用ModelAndView进行页面跳转.思路是发送POST请求,然后controller层中直接返回相应ModelAndView,但是这种方法不可 ...

  6. SpringMVC经典系列-13使用SpringMVC处理Ajax请求---【LinusZhu】

    注意:此文章是个人原创,希望有转载须要的朋友们标明文章出处,假设各位朋友们认为写的还好,就给个赞哈,你的鼓舞是我创作的最大动力,LinusZhu在此表示十分感谢,当然文章中如有纰漏,请联系linusz ...

  7. springmvc框架下ajax请求传参数中文乱码解决

    springmvc框架下jsp界面通过ajax请求后台数据,传递中文参数到后台显示乱码 解决方法:js代码 运用encodeURI处理两次 /* *掩码处理 */ function maskWord( ...

  8. SpringMVC处理ajax请求的注意事项

    .首先要知道ajax请求的核心是JavaScrip对象和XmlHttpRequest,而浏览器请求的核心是浏览器 ajax请求 浏览器请求 场景一:使用ajax获取session中的user 从上图可 ...

  9. springmvc接受及响应ajax请求。 以及@RequestBody 和@ResponseBody注解的使用

    1.发送ajax请求 $.ajax({ url:"user/testAjax", contentType:"application/json;charset=UTF-8& ...

随机推荐

  1. python+php+redis+shell实现几台redis的同步数据

    之所以使用python,是因为python多线程非常简单. 之所以使用shell,是因为写了个服务,可以方便的重启python写的那个脚本. 总体思路:利用redis的发布订阅,php作为生产者,py ...

  2. pt-online-schema-change 实例

    pt-pmp (http://www.cnblogs.com/ivictor/p/6012183.html) pt-online-schema-change (http://blog.csdn.net ...

  3. windows环境下局域网内无法访问apache站点

    DocumentRoot "D:/wamp/www/" <Directory />     AllowOverride none     order deny,allo ...

  4. php命令传参

    1.url方式 $param = array(); if ($argc > 1) { parse_str ( $argv [1], $param ); foreach ( $param as $ ...

  5. 在VBA中调用winsock控件

    如果系统没有Winsock控件的话,可以下载下面的控件MSWINSCK.OCX,然后将该文件复制到C:\Windows\System32目录下. 在VBE窗口中,从菜单"工具"-& ...

  6. MemcacheQ 安装与使用

    MemcacheQ 是一个基于 MemcacheDB 的消息队列服务器.官网地址:http://memcachedb.org/memcacheq/ 特点: 1.简单易用. 2.处理速度快. 3.可创建 ...

  7. 操作系统中前台进程与后台进程(适用于Linux)

    两种进程的主要区别: 1.前台进程用户可以操作,后台进程用户不能操作(除了把它关闭). 2.前台进程不全是由计算机自动控制,后台进程全都是由计算机自动控制. 3.后台进程一般用作系统服务,可以用cro ...

  8. ADF_Database Develop系列2_设计数据库表之Table Partitions/Create Users/Generate DDL

    2013-05-01 Created By BaoXinjian

  9. [Tex学习笔记]一个数学公式

    \begin{equation*} \begin{aligned} &\quad\int |\nabla(T_1-\overline{T})^+|^2 \rm dx-\int \frac{3m ...

  10. gradle大体内容

    buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:grad ...