求一个ajax跟ssh2整合的案例,最好能跟我说下要哪些jar包等等 ssh2ajax 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ajax也就和struts2有点关系,和hibernate、spring扯不上什么事。关键点无非就是struts2处理ajax请求,并通过json插件返回json数据。但是不推荐struts的json插件,推荐使用这种方法:在Action中retrun null,然后通过response.getWriter().wirite(str)的方式输出ajax响应的响应文本。 你整合出什么问题了,我觉得Ajax最多用一个jQuery的js文件 你需要jar 做什么?是因为jar 的原因吗?出什么错误最好贴出来看看。 这些框架使用手册都已经描述了和对应的框架整合的例子,里面肯定也有需要用到的jar。 为什么$(document).ready(function(){ $("#b1").click(function(){ $.getJSON("testAction_getMsg.action",function(data){ alert(data.msg); $("#message").show().html(data.msg); }) }); });这里出来的信息是我action中的返回值不是msg,public String getMsg() throws Exception { msg="hello World"; System.out.println("==================="); ServletActionContext.getResponse().getWriter().write(msg); return "returnJSON"; }alert出来的是returnJSON,而不是hello World 加上ServletActionContext.getResponse().getWriter().close(); 急!高手进!用Freemarker生成word的奇怪问题! 关于tomcat的虚拟路径问题。。。。 Freemaker的<#list> 问题 求教~~~ 如何在javascript中读取一个指定了路径的xml文件的内容,读取到的内容是不是一个大字符串? 如何统计相同字段不相同内容的个数 (语句怎么写) 求问,关于JSP页面传参数给ACTION 散分了,救命了,各位高人,用java 怎么画雷达图啊!等………… 怎样能使struts action转出的页面能指定转入的桢 急问一个TOMCAT的配置问题(jndi)? 数据库转换 求各位大神指点迷津 关于birt报表的问题,希望大家能指点一下
关键点无非就是struts2处理ajax请求,并通过json插件返回json数据。
但是不推荐struts的json插件,推荐使用这种方法:在Action中retrun null,然后通过response.getWriter().wirite(str)的方式输出ajax响应的响应文本。
$("#b1").click(function(){
$.getJSON("testAction_getMsg.action",function(data){
alert(data.msg);
$("#message").show().html(data.msg);
})
});
});
这里出来的信息是我action中的返回值不是msg,
public String getMsg() throws Exception {
msg="hello World";
System.out.println("===================");
ServletActionContext.getResponse().getWriter().write(msg);
return "returnJSON";
}
alert出来的是returnJSON,而不是hello World