日期:2014-05-17 浏览次数:20603 次
private boolean flag = false; private String msg = "未开始"; //getter 和 setter 构造之类全有
private List<Result> detail; private Result success; public String importOrder() { detail = service.importOrderByOrderIDs(ids, this.getOperatorUserId()); success = new Result(true,"订单导入 完成!"); return "success";
<package name="testcard_ajax" extends="json-default" namespace="/testcard_ajax"> <action name="testcard_*" class="com.aspire.web.testcardinfo.action.TestCardInfoAction" method="{1}"> <result name="success" type="json"> <param name="includeProperties"> detail,success </param> </result> </action> </package>
$.ajax({ type: 'POST', url: "/ec_web/testcard_ajax/testcard_importOrder.do", data:{"importOrderIdStr":ids.toString(),ajax:true }, success: function(jsonss){ var flag = jsonss.success.flag; //断点1 var title=jsonss.success.msg; var results = jsonss.detail; } });
<param name="includeProperties"> detail,success </param>
------解决方案--------------------
我在项目中是这样配置的:
<!-- 驗證 角色代碼是否存在 --> <action name="validateRoleCode" class="roleAction" method="validateRoleCode"> <result type="json"> <param name="includeProperties">status</param> </result><!--这里的status只是一个String --> </action> <action name="getUserCodeForRoleCreate" class="roleAction" method="getUserCodeForRoleCreate"> <result type="json"> <param name="includeProperties">userList.*</param> </result><!--这里的userList装的是一个user对象--> </action>
------解决方案--------------------
<param name="includeProperties">
detail,success
</param>
把这个改下。
<param name="aa"> detail </param>
<param name="dd"> success</param>
在回调函数中直接用jsonss.aa就是detail 。 jsonss.dd就是success ,
------解决方案--------------------
private List<Result> detail; private Result success;