js代码
var param1 = 12;var param2 = 24;
$ajax({
type:"POST",
url:"ajax",
data:{'param1': param1, 'param2': param2},
success:function(data){
}
});
action配置(假如ajax url匹配comtestAjax这个类)
<action name="ajax" class="comtestAjax"><result name="success">/successjsp</result>
</action>
后台代码(Ajax类)
package comtest;import comopensymphonyxwork2ActionSupport;
public class Ajax extends ActionSupport{
private Integer param1;
private Integer param2;
public void setParam1(Integer param1) {
thisparam1 = param1;
}
public void setParam2(Integer param2) {
thisparam2 = param2;
}
@Override
public String execute() throws Exception {
Systemoutprintln(param1);
Systemoutprintln(param2);
return SUCCESS;
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)