日期:2014-05-16 浏览次数:20546 次
jQuery.post( "test1.action", {"param":param}, function(data){ //dosomething in success. if(data.success == "success"){ } }, "json" );
<package name="jsonDefault" namespace="" extends="json-default"> <action name="test*" method="test{1}" class="***"> <result name="success" type="stream"> <param name="contentType">text/html</param> <param name="inputStream">inputStream</param> </result> </action>
private transient InputStream inputStream; public String test1(){ StringBuilder sb = new StringBuilder(); sb.append("{'result':'success'}"); inputStream=new ByteArrayInputStream(sb.toString().getBytes("utf-8")); return SUCCESS; }