$.ajax({
type:"post",
url:form.action,
data:{
descId:descId,
notShow:1
},
success:function(){
form.action = nextUrl;
form.submit();
}
});
jquery提交的data。在struts2中可以用属性的方式
private String notShow;
private String descId;
,
也可以用获得参数的方式
notShow = req.getParameter("notShow");
descId = req.getParameter("descId");
。之前都是用的属性的方式,今天试了下参数的方式,OK的
本文介绍使用jQuery进行Ajax请求时如何与Struts2框架交互。通过实例展示了两种方式:一是利用Struts2的属性映射,二是直接从请求中获取参数。这两种方式均能实现数据的有效传递。
1万+

被折叠的 条评论
为什么被折叠?



