jquery easyui + Struts2解决方法
jquery easyui + Struts2
com.test.action.SelectInfoAction :
public String queryInfoList(){
ActionContext ctx = ActionContext.getContext();
List<Info> infoList = queryInfoService.queryInfoData();
JSONObject jo = new JSONObject();
jo.put("total", infoList.size());
jo.put("rows", infoList);
String result = jo.toString();
System.out.println(result);
try {
ctx.put("json", jo);
} catch (Exception e) {
e.printStackTrace();
}
return "success";
}
---------------------------------------------------------------------
selectInfo.jsp :
<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>订购信息查询</title>
<%@ include file="/jsp/common/common.jsp"%>
</head>
<body>
<div class="page_title">
订购信息查询
</div>
<!-- <form action="queryByAppIDAction" method="post">
产品id:<input name="info.appID" size="10"/><input type="submit" value="查询"/>
</form> -->
<table id="tt" title="信息列表" class="easyui-datagrid" style="width: auto; height: auto;"
url="queryInfoListAction"
iconCls="icon-save" fitColumns="true" pagination="true">
<thead>
<tr>
<th field="appID" width="200" align="center">产品id</th>
<th field="actionTime" width="200" align="center">扣费时间</th>
<th field="payCode" width="200" align="center">产品计费点</th>
</tr>
</thead>
</table>
</body>
</html>
----------------------------------------------------------
struts.xml :
<action name="queryInfoListAction" class="com.test.action.SelectInfoAction" method="queryInfoList">
<result name="success">/jsp/selectInfo.jsp</result>
<result name="error">/jsp/error.jsp</result>
</action>
easyui为啥加载不了action里面的数据?
System.out.println(result);可以打印出值:
{"total":3,"rows":[{"actionID":1,"actionTime":"20130619144435","appID":"300001489326","channelID":"2000000032","checkID":0,"dest_Address":"400 --- SPSYN","exData":"","feeMsisdn":"ECAD2EVFADF3AE2A","id":1,"md5Sign":"ABCDEFGHIKDFIEJFLAKDJFSIDF","msgType":"SyncAppOrderReq","msisdn":"","orderID":"11130619144434998192","orderPayment":1,"orderType":1,"payCode":"30000148932601","price":100,"programID":null,"send_Address":"200 --- CSSP","subsNumb":1,"subsSeq":1,"totalPrice":100,"tradeID":"L0IF7AF2J4L5IF1B","transactionID":"CSSP16122856","version":"1.0.0"},{"actionID":1,"actionTime":"20130619144435","appID":"300001489327","channelID":"2000000032","checkID":0,"dest_Address":"400 --- SPSYN","exData":"","feeMsisdn":"ECAD2EVFADF3AE2A","id":2,"md5Sign":"ABCDEFGHIKDFIEJFLAKDJFSIDF","msgType":"SyncAppOrderReq","msisdn":"","orderID":"11130619144434998192","orderPayment":1,"orderType":1,"payCode":"30000148932601","price":100,"programID":null,"send_Address":"200 --- CSSP","subsNumb":1,"subsSeq":1,"totalPrice":100,"tradeID":"L0IF7AF2J4L5IF1B","transactionID":"CSSP16122856","version":"1.0.0"},{"actionID":1,"actionTime":"20130619144435","appID":"300001489328","channelID":"2000000032","checkID":0,"dest_Address":"400 --- SPSYN","exData":"","feeMsisdn":"ECAD2EVFADF3AE2A","id":3,"md5Sign":"ABCDEFGHIKDFIEJFLAKDJFSIDF","msgType":"SyncAppOrderReq","msisdn":"","orderID":"11130619144434998192","orderPayment":1,"orderType":1,"payCode":"30000148932601","price":100,"programID":null,"send_Address":"200 --- CSSP","subsNumb":1,"subsSeq":1,"totalPrice":100,"tradeID":"L0IF7AF2J4L5IF1B","transactionID":"CSSP16122856","version":"1.0.0"}]}
------解决思路----------------------
你浏览器输 url 看返回json数据不?
参考
------解决思路----------------------
哈哈哈 解决了就好 我好久不做这些了 一直在搞Android
com.test.action.SelectInfoAction :
public String queryInfoList(){
ActionContext ctx = ActionContext.getContext();
List<Info> infoList = queryInfoService.queryInfoData();
JSONObject jo = new JSONObject();
jo.put("total", infoList.size());
jo.put("rows", infoList);
String result = jo.toString();
System.out.println(result);
try {
ctx.put("json", jo);
} catch (Exception e) {
e.printStackTrace();
}
return "success";
}
---------------------------------------------------------------------
selectInfo.jsp :
<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>订购信息查询</title>
<%@ include file="/jsp/common/common.jsp"%>
</head>
<body>
<div class="page_title">
订购信息查询
</div>
<!-- <form action="queryByAppIDAction" method="post">
产品id:<input name="info.appID" size="10"/><input type="submit" value="查询"/>
</form> -->
<table id="tt" title="信息列表" class="easyui-datagrid" style="width: auto; height: auto;"
url="queryInfoListAction"
iconCls="icon-save" fitColumns="true" pagination="true">
<thead>
<tr>
<th field="appID" width="200" align="center">产品id</th>
<th field="actionTime" width="200" align="center">扣费时间</th>
<th field="payCode" width="200" align="center">产品计费点</th>
</tr>
</thead>
</table>
</body>
</html>
----------------------------------------------------------
struts.xml :
<action name="queryInfoListAction" class="com.test.action.SelectInfoAction" method="queryInfoList">
<result name="success">/jsp/selectInfo.jsp</result>
<result name="error">/jsp/error.jsp</result>
</action>
easyui为啥加载不了action里面的数据?
System.out.println(result);可以打印出值:
{"total":3,"rows":[{"actionID":1,"actionTime":"20130619144435","appID":"300001489326","channelID":"2000000032","checkID":0,"dest_Address":"400 --- SPSYN","exData":"","feeMsisdn":"ECAD2EVFADF3AE2A","id":1,"md5Sign":"ABCDEFGHIKDFIEJFLAKDJFSIDF","msgType":"SyncAppOrderReq","msisdn":"","orderID":"11130619144434998192","orderPayment":1,"orderType":1,"payCode":"30000148932601","price":100,"programID":null,"send_Address":"200 --- CSSP","subsNumb":1,"subsSeq":1,"totalPrice":100,"tradeID":"L0IF7AF2J4L5IF1B","transactionID":"CSSP16122856","version":"1.0.0"},{"actionID":1,"actionTime":"20130619144435","appID":"300001489327","channelID":"2000000032","checkID":0,"dest_Address":"400 --- SPSYN","exData":"","feeMsisdn":"ECAD2EVFADF3AE2A","id":2,"md5Sign":"ABCDEFGHIKDFIEJFLAKDJFSIDF","msgType":"SyncAppOrderReq","msisdn":"","orderID":"11130619144434998192","orderPayment":1,"orderType":1,"payCode":"30000148932601","price":100,"programID":null,"send_Address":"200 --- CSSP","subsNumb":1,"subsSeq":1,"totalPrice":100,"tradeID":"L0IF7AF2J4L5IF1B","transactionID":"CSSP16122856","version":"1.0.0"},{"actionID":1,"actionTime":"20130619144435","appID":"300001489328","channelID":"2000000032","checkID":0,"dest_Address":"400 --- SPSYN","exData":"","feeMsisdn":"ECAD2EVFADF3AE2A","id":3,"md5Sign":"ABCDEFGHIKDFIEJFLAKDJFSIDF","msgType":"SyncAppOrderReq","msisdn":"","orderID":"11130619144434998192","orderPayment":1,"orderType":1,"payCode":"30000148932601","price":100,"programID":null,"send_Address":"200 --- CSSP","subsNumb":1,"subsSeq":1,"totalPrice":100,"tradeID":"L0IF7AF2J4L5IF1B","transactionID":"CSSP16122856","version":"1.0.0"}]}
------解决思路----------------------
你浏览器输 url 看返回json数据不?
参考
------解决思路----------------------
哈哈哈 解决了就好 我好久不做这些了 一直在搞Android