It's like user click a link and in the Spring controller class a method will respond to the request with a JSON object and also a view name (meaning, it should return but not only a JSON object but also a HTTP view which hold that JSON object, so @ResponseBody may not enough)? Do we have to split it up into two methods (one for view and the other for JSON object)? Any ideas will be appreciated.
Normally we have
@RequestMapping(value="/someValue")
public @ResponseBody someMethod1(@RequestParam String param){
.....
return someJSONObject
}
To handle JSON object, and
@RequestMapping(value="/someValue")
public String someMethod2(@RequestParam String param){
.....
return someViewInString;
}
To return the view.
How can we combine them together?
${name_of_json_attr}? (I guess this may only work if your view isjsp)