刚开始接触EXT,可以搞了2天了,一个小小的测试都没有搞出来
大侠们帮忙看看吧 ~~~ 后台能取到数据,可前台怎么都取不到json,页面上能显示出grid框和列 但是没有数据;大家看我的代码可能会发现我的列都是中文的,这是由于我们的项目的原因,我查过资料EXT对中文取值是支持的
我的jsp也是UTF-8的
json的后台打印:{"pageInfo":1,"data":[{"签发人":"","归档":"","登记号":"001","保管期限":"10年","文件标题":"关于什么的测试情况","原文路径":"","份数":"","主题词":"啊","备注":"","正文":"","归档份数":"","处理单":"","密级":"机密","责任者":"啊","拟稿人":"","办结提示":"","分类号":"020","成文日期":"20081009","页数":"1","全宗号":"","缓急程度":"","签发时间":"","拟稿部门":"","主办部门":"","文号":"综[2008]1号","附件":"","登记日期":"20081009"}]}
java(action)的写法:
[code="java"]JSONArray ary = new JSONArray(recodList);
JSONObject jo = new JSONObject();
jo.put("data", ary);
jo.put("pageInfo",recodList.size());
String jstr=jo==null?"":jo.toString();
boolean scriptTag = false;
String cb = request.getParameter("callback");
if (cb != null) {
scriptTag = true;
response.setContentType("text/html;charset=UTF-8");
} else {//"text/html;charset=UTF-8" "text/javascript;charset=UTF-8" "application/x-json;charset=UTF-8"
response.setContentType("text/html;charset=UTF-8");
}
if (scriptTag) {
jstr = cb + "("+jstr+")";
}
System.out.println(jstr);
response.getWriter().print(jstr);[/code]
jsp(js代码)
[code="java"]
<html>
<head>
<link rel="stylesheet" type="text/css" href="scripts/ext/resources/css/ext-all.css" />
<script type="text/javascript" src="scripts/ext/adapter/ext/ext-base.js"> </script>
<script type="text/javascript" src="scripts/ext/ext-all.js"> </script>
<script type="text/javascript" src="scripts/ext/ext-all-debug.js"> </script>
<script type="text/javascript" src="scripts/ext/source/locale/ext-lang-zh_CN.js"> </script>
<script type="text/javascript" >
var APP_PATH='/esoaisapp';
Ext.onReady(function(){
[1] [2] [3] [4] [5] [6] [7] [8] 下一页