您的位置:首页 > 移动开发

EXTJS 2.0 + struts2.0 在 google app 上面跑通测试.

2014-11-14 00:00 411 查看
新的东西要不断学习.

不知道.用 extjs 的人多么.

用的开发工具还是用的 GWT的那个工具.发布部署上去了.

action 层.不能使用 模型驱动. 需要对每一个参数 进行

request.getParameter.() 得到.(google app的struts2 这个拦截跑不了)

service层业务逻辑.编写业务逻辑.需要手动将 结果写成一个 json 的格式.json lib 也被限制了.

dao层.没有数据库而是之间将bean序列号化 到服务器.

目前还没有 ioc的容器.
http://freewebsys.appspot.com/
部署上去了.

附近是源代码..没有放jar包

自己写了一个json转换.

写道

private String toPageJSON(int size, List<User> results) {

StringBuffer json = new StringBuffer();

// 将返回数据拼接成一个json的分页格式.

json.append("{\"results\":\"");

json.append(size);

json.append("\",\"items\":[");

for (int i = 0; i < results.size(); i++) {

json.append(toObjectJSON(results.get(i)));

if ((i + 1) != results.size()) {/* 不是最后一个.添加逗号. */

json.append(",");

}

}

json.append("]}");

return json.toString();

}

private String toObjectJSON(User user) {

StringBuffer json = new StringBuffer();

json.append("{");

json.append("\"id\":" + "\"" + user.getId() + "\",");

json.append("\"name\":" + "\"" + user.getName() + "\",");

json.append("\"email\":" + "\"" + user.getEmail() + "\"");

json.append("}");

return json.toString();

}

写的比较匆忙.应该用 反射改改..

不知道.这个extjs的速度 怎么样.

有兴趣的可以 邮件联系.

toeoso@gmail.com
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: