|
推荐
楼主 | 发表于 2015-5-19 07:32:53 | 只看该作者
本帖最后由 biyaooo 于 2015-5-19 18:27 编辑
后端利用Baas添加的 queryUserInfo动作代码
- private static void queryUserInfo(ServletRequest request, ServletResponse response) throws SQLException, IOException, NamingException {
- // 参数序列化
- JSONObject params = (JSONObject) JSONObject.parse(request.getParameter("params"));
-
- // 获取参数
- Object columns = params.get("columns"); // 列定义
- Integer limit = params.getInteger("limit"); // 分页查询的行数
- Integer offset = params.getInteger("offset"); // 分页查询的行偏移
- String username = params.getString("username"); // 分页查询的行数
- String password = params.getString("password"); // 检索关键字
- //System.out.println(password);
- // 存放SQL中的参数值
- List<Object> sqlParams = new ArrayList<Object>();
- // 存放SQL中的过滤条件
- List<String> filters = new ArrayList<String>();
-
-
- filters.add("username = ? and password =?");
- sqlParams.add(username);
- sqlParams.add(password);
-
-
- Table table = null;
- // 获取数据源连接
- Connection conn = Util.getConnection(DATASOURCE_BLSHOPAPP);
- try {
- // 执行单表数据查询,返回Table
- table = Util.queryData(conn, TABLE_APP_USER, columns, filters, "fID DESC", sqlParams, offset, limit);
- } finally {
- // 必须关闭数据源连接
- conn.close();
- }
-
- // 输出Table做为返回结果,这里会自动转换为Table的JSON格式
- Util.writeTableToResponse(response, table);
- }
复制代码
通讯录加载对应的JS代码 Content3.js
- Model.prototype.addresslistDataCustomRefresh = function(event){
- var data = event.source;
- //alert(Baas.getDataColumns(data));
- // 构造请求参数
- var params = {
- // 列定义
- // "columns" : data.getColumnIDs(),
- // 应从前端传入完整列定义(Baas.getDataColumns(data)), 以解决oracle等数据库不区分date、time、datetime,导致的数据格式转换问题;
- // 服务端兼容了以前只传入列名字符串(data.getColumnIDs())的写法,但是已不再推荐。
- //"columns" : Baas.getDataColumns(data),
- // 分页信息 - 行数
- "limit" : event.limit,
- // 分页信息 - 行偏移
- "offset" : event.offset,
- // 检索关键字
- "search" : this.getElementByXid("addressInput").value
- };
- // 请求成功后的回调方法
- var success = function(resultData) {
- // 通过event.options.append判断数据是否增量加载
- var append = event.options && event.options.append;
- // 加载返回数据到data
- data.loadData(resultData, append);
- };
- // 发送请求
- Baas.sendRequest({
- "url" : "/blshop", // servlet请求地址
- "action" : "queryAddressList", // action
- "params" : params, // action对应的参数
- "success" : success // 请求成功后的回调方法
- });
- };
-
复制代码
通讯录的代码,我的程序分了4个Content,我只把通讯录里面Content的代码贴出来
Content3.w
- <div class="x-contents-content" xid="content4"><div component="$UI/system/components/justep/panel/panel" class="x-panel x-full" xid="panel3">
- <div class="x-panel-top" xid="top3">
- <div component="$UI/system/components/justep/row/row" class="x-row" xid="row3">
- <div class="x-col" xid="col15">
- <div class="input-group" component="$UI/system/components/bootstrap/inputGroup/inputGroup" xid="inputGroup2">
- <input type="text" class="form-control" component="$UI/system/components/justep/input/input" xid="addressInput" onChange="{operation:'addresslistData.refresh'}"></input>
- <div class="input-group-btn" xid="div6">
- <a component="$UI/system/components/justep/button/button" class="btn x-black btn-only-icon" label="button" xid="button10" icon="icon-android-search" onClick="{operation:'addresslistData.refresh'}">
- <i xid="i3" class="icon-android-search"></i>
- <span xid="span3"></span></a> </div> </div> </div> </div> </div>
- <div class="x-panel-content" xid="content7">
- <div class="x-scroll" component="$UI/system/components/justep/scrollView/scrollView" xid="scrollView1">
- <div class="x-content-center x-pull-down container" xid="div7">
- <i class="x-pull-down-img glyphicon x-icon-pull-down" xid="i16"></i>
- <span class="x-pull-down-label" xid="span5">下拉刷新...</span></div>
- <div class="x-scroll-content" xid="div16">
- <div component="$UI/system/components/justep/list/list" class="x-list" xid="list1" data="addresslistData" limit="-1">
- <ul class="x-list-template" xid="listTemplateUl1">
- <li xid="li1">
- <div component="$UI/system/components/justep/row/row" class="x-row" xid="row2" style="padding:0px">
- <div class="x-col" xid="col12">
- <div component="$UI/system/components/justep/labelEdit/labelEdit" class="x-label-edit" xid="labelOutput1" style="margin:0px">
- <label class="x-label" xid="label2"><![CDATA[姓名:]]></label>
- <div component="$UI/system/components/justep/output/output" class="x-output x-edit" xid="output5" bind-ref="ref('name')"></div></div></div>
- <div class="x-col" xid="col13">
- <label xid="label5"><![CDATA[电话:]]></label>
- <a xid="a1" bind-text="ref('phone')" data-bind="attr:{href:'tel:'+val('phone')}"><![CDATA[]]></a></div>
- </div>
- <div component="$UI/system/components/justep/row/row" class="x-row" xid="row5">
- <div class="x-col" xid="col16" style="padding:0px;border-bottom-style:dashed;border-bottom-width:1px;border-bottom-color:#15800D;"><div component="$UI/system/components/justep/labelEdit/labelEdit" class="x-label-edit" xid="labelOutput3" style="margin:0px">
- <label class="x-label" xid="label4" style="background-color:transparent;"><![CDATA[通讯地址:]]></label>
- <div component="$UI/system/components/justep/output/output" class="x-output x-edit" xid="output7" bind-ref="ref('address')"></div></div></div>
- </div></li> </ul> </div>
- </div>
- <div class="x-content-center x-pull-up" xid="div5">
- <span class="x-pull-up-label" xid="span17">加载更多...</span></div> </div> </div> </div></div>
复制代码
|
|
相关推荐
WeX5.Baas服务详解
阿里云区块链baas介绍
1. UI2/takeout 这个是页面,由页面文件.w和js以及css等构成,js中有$.ajax的请求 2. Native/外卖 这个是本地app的工程,用来打包app 3. tomcat的webapps/baas 这个是服务端,提供步骤1中的$.ajax访问 启动服务 ...
baas平台构思,如何设计自己的Baas?来来来块下载,看看是否有帮助。只是页面设计。纯html设计
使用国内BaaS提供商AVOS的小demo,里面包含apk可以运行,以及提供的源代码。
白皮书中详细阐述了区块链技术带来的产业变革,着重分析了区块链即服务(Blockchain as a Service, BaaS)的重要意义。云的开放性和云资源的易获得性,决定了公有云平台是当前区块链创新的最佳载体,区块链与云计算...
区块链BaaS云平台介绍.ppt
BAAS 设计规范 , 通过本文档规范BAAS平台所有向外提供API,体现技术的统一性,规范性。并使得所有API尽量靠近业界规范的同时,提高API的易用性、可读性、兼容性等,并方便平台的使用者更快地发现、熟悉所有API以供...
sgtcloud 是为 html5 游戏开发者量身打造的baas服务,提供了10余种开箱即用的游戏模块,不用写一行代码,立刻享用专业简便的 sdk 接入和后台面板。如果您开发复杂的重度游戏,sgtcloud 也提供了高级的应用托管功能,...
基于BaaS开发微信支付小程序.pdf
区块链即服务平台BaaS白皮书.pdf
版权声明本白皮书版权属于可信区块链推进计划区块链即服务平台BaaS项目组,并受法律保护,转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:可信区
区块链与云计算融合发展BaaS成大势所趋.pdf
新能源汽车行业周报:蔚来与宁德时代携手推出BaaS业务.pdf
区块链即服务baas白皮书
#资源达人分享计划#
中国信息通信研究院 ,可信区块链推进计划,《区块链即服务平台BaaS白皮书(1.0版)》打破传统企业业务系统桎梏
2006年,Amazon发表了弹性运算服务云端(EC2)和简单储存服务(S3),这几项服务为云计算技术在21世纪开启了一个新篇章,云服务就此从 IaaS 进展到了 PaaS层级。之后,云计算服务继续发展、演变,又新出现一批_aaS系...
作者:赵静,多年互联网领域从业经验,现服务于Maxleap基础服务及架构组,主要负责云数据(CloudData)架构设计及研发,关注分布式计算、云存储。
#资源达人分享计划#