【发布时间】:2016-09-28 14:15:31
【问题描述】:
我们可以通过json拦截器将JSON发送到Struts2动作。 http://tech.learnerandtutor.com/send-json-object-to-struts-2-action-by-jquery-ajax/ 有很好的示例。
json拦截器要求请求content type为application/json或application/json-rpc,这可以在我们直接使用Ajax时设置,如:
$.ajax({
url: "writeJSON.action",
data: data1,
dataType: 'json',
contentType: 'application/json',
但我们使用的是 struts 2 jquery 插件标签(sj:a 和 sj:submit ...),它们为我们管理 ajax 调用。
有什么方法可以用这些标签设置contentType。
我没有找到这个标签属性。
如果没有实现,有没有其他方法可以设置。
【问题讨论】:
标签: jquery json ajax struts2 struts2-jquery