当我构建一个模块/组件时,我需要将什么传递给 ActionResult 以便在 Ajax 调用中接收正确的 HTTPServletRequest?
例如(在我的 jsp 中):
var location = '${currentNode.path}.sqlPaging.do';
$.post(location, function(data) {
temp=data;
alert(data.info);
$('#result').html(data);
});
更多信息(这是我的班级):
@Override
public ActionResult doExecute(HttpServletRequest req, RenderContext renderContext, Resource resource,
JCRSessionWrapper session, Map<String, List<String>> parameters, URLResolver urlResolver)
throws Exception {
JSONObject json = new JSONObject();
json.put("info",3.14);
ActionResult result = new ActionResult(HttpServletResponse.SC_OK, null, json);
result.setJson(json);
return result;
}
使用的包:javax.servlet.http org.jahia.bin.ActionResult org.json.JSONObject