【发布时间】:2015-03-05 12:53:54
【问题描述】:
我是使用 spring roo、ajax 和 json 的新手,我有一个问题。如果您使用一些 roo shell 命令,Roo 在控制器类中创建两种方法来列出实体的所有元素,一种用于 ajax/json,一种不用于 json。
ajax/json 方法注解是
@RequestMapping(headers = "Accept=application/json")
@ResponseBody
public ResponseEntity<String> "Controller".listJson()
另一种方法是:
@RequestMapping(produces = "text/html")
public String "Controller".list
这两种方法都有这个路径@RequestMapping("/admtpcomunidads")
当我尝试使用 dojo 从 javascript 调用 ajax/json 方法时,我使用:
dojo.xhrGet({url: "admtpcomunidads",
handleAs: 'json',
但是调用链接到“Controller.list”方法而不是“Controller.listJson”方法。我需要在 dojo.xhrGet 调用中使用什么 url 来链接 listJson 方法?
谢谢
【问题讨论】:
标签: spring-roo