日期:2014-05-16 浏览次数:20647 次
var url="${pageContext.request.contextPath}/updateHSwitch.action"; $.post(url,{isID:hsID,isSwitch:hsSwitch,dataType:"json",success:function(jsonres){ alert(jsonres); ? ? ? ? ? ? ?//?s??弹出??????undefined? var json = eval("(" + jsonres + ")"); alert(json);? ? ? ? ?//?s??弹出??????undefined? } });
public String updateHSwitch() { System.out.println("............."); if(isID==100) return "ERROR"; dataList=hostSwitchBiz.getHostSwitch(isID); //根据ID获取信息 for (int i = 0; i < dataList.size(); i++) { hostswitch=(SwHostswitch)dataList.get(i); } hostswitch.setIsSwitch(isSwitch); //替换开关状态数据 explanList=hostSwitchBiz.updateHSwitch(hostswitch); //更新整条数据 JSONArray jsonres=JSONArray.fromObject(explanList); System.out.println(jsonres.toString());? //??输出[{"isCommand":"#58008# ","isOpenExplain":"语音提示 ","isState":"内部空号音提示","isSwitch":"0","isShutExplain":"听空好音 ","isExplain":"内部空好音提示:1 语音提示,0 听空号音","isId":8}] return "jsonres"; }
<package name="json" namespace="/" extends="json-default"> <action name="updateHSwitch" class="hostSwitchAction" method="updateHSwitch"> <result name="jsonres" type="json" /> </action> </package>?