程式碼如下:
import com.alibaba.fastjson.JSONPObject;
@RequestMapping(value = "/method1") @ResponseBody public JSONPObject method1(Req req,String callback) { JSONPObject returnJsonp = new JSONPObject(callback); try { Object obj = "hello"; returnJsonp.addParameter(obj); } catch (Exception e) { } return returnJsonp; }