SSHI注解框架操作手册

上传人:1777****777 文档编号:36149969 上传时间:2021-10-29 格式:DOC 页数:21 大小:326.50KB
返回 下载 相关 举报
SSHI注解框架操作手册_第1页
第1页 / 共21页
SSHI注解框架操作手册_第2页
第2页 / 共21页
SSHI注解框架操作手册_第3页
第3页 / 共21页
点击查看更多>>
资源描述
级别:秘密文档编号:项目编号_年份_文档类型_文档序号SSHI注解框架操作手册版本:V1.0湖南省赛宝软件服务有限公司All Right Reserved (C) 2010-2011XXXXXXXXXX系统-操作手册 版本:V1.0目录更新历史1前言2第一章 软件的安装与常用配置31.1、软件安装环境要求31.1.1、软件环境31.1.2、硬件环境31.2、软件的安装指导31.2.1、服务器端安装31.2.2、客户端安装31.3、数据库初始化31.3.1、数据库管理系统的安装31.3.2、数据库安装及数据导入31.4、用户权限设置(软件授权与许可)31.5、软件使用特点及惯例3第二章 技术框架42.1、web层:struts2+conversion注解插件42.2、持久层:hibernate+ibatis42.2、IOC:SPRING42.4、页面UI:EXTJS44第三章 项目整体结构53.1、代码结构5第四章 CODEFLY使用说明64.1、使用说明6湖南省赛宝软件服务有限公司 page: 19更新历史版本号作者(日期)评审者(日期)批准者(日期)说明1.1李鸿翼 2011-7-26初评稿前言为了让用户初步了解如何使用sshi 框架,以及该程序的一些主要特征,我们特撰写了此操作手册。手册根据程序的菜单组织章节,每个菜单为一个章节,共有4个章节,涵盖了sshi 框架软件的所有功能及一些理论知识。如果本手册能促使软件使用者更加熟练使用sshi 框架,手册的编撰者便感到非常欣慰了。本手册由李鸿翼编写,第一章为软件的安装配置权限控制信息,新的功能模块从第二章开始。由于编者水平有限,时间紧张,手册中一定存在疏漏和不足,恳请广大用户批评指证。 编 者:李鸿翼 2011 年 7月 26日第一章 软件的安装与常用配置1.1、软件安装环境要求1.1.1、软件环境eclipse jdk6tomcat71.1.2、硬件环境 无1.2、软件的安装指导 无1.2.1、服务器端安装 无1.2.2、客户端安装 BS系统此处为从浏览器如何访问,cs系统则为实际如何安装客户端软件1.3、数据库初始化1.3.1、数据库管理系统的安装 无1.3.2、数据库安装及数据导入 无1.4、用户权限设置(软件授权与许可) 无1.5、软件使用特点及惯例 无1.6、基础知识学习网站技术部共享工具:192.168.0.129 Html : Javacript : 第二章 技术框架后台调用架构:2.1、web层:struts2+conversion注解插件l URL ACTION匹配规则:xtgl/user!add.action - xtgl包下的UserAction里的add方法 l 在action里如何使用service: 使用resource注解 如: Resource(name=”xxxServiceImpl”) Name的值为具体实现类名(首字母小写)2.2、持久层:hibernate+ibatis 略2.2、IOC:SPRING 略2.3、页面UI:EXTJS41.Extjs开发包: Bulid目录是ext压缩后的代码。Docs目录包含ext文档,特别重要的是api。Examples目录包含官方演示实例Local目录包含多国语言的资源文件,其中是简体中文 Pkgs目录是ext各部分功能的打包 Resource目录包含ext的所有图片和样式 Src目录是未压缩的源码Bootstrap.js是ext的引导文件,可以自动切换ext-all.js和ext-all-debug.jsExt-all.js文件是核心库,必须引入Ext-all-debug是ext-all.js的调试版本2.如何建立一个hello word.解压引入到eclipse.3.extjs基本概念 panel面板 : 面板是一块空白区域,里面可以放各种组件,支持extjs的各种布局。Layout布局 : 布局是指组件在一个容器中的摆放方式。Componenet组件 : 组件是可以重用的特定功能。如简单的按钮,数据表格等。Window窗体: 它并不是一个真正的windows窗口,继承于面板,本质是一个css层,所以不可能拖拽到浏览器外 。Dialog对话框 : 普通对话框、选择对话框、输入对话框,其本质也是一个css格式化好的层。4.json对象Json对象以”开始,以”结束,属性名和值以”:”分割,属性间用“,”分割。例如: var Person = name :tom,age:23,books : name : java,name : .net属性值可以是字符串,数字,数组,也可以是json对象。 5.常用函数 Ext.onReady(function(); 当页面元素加载完毕后,执行function。Ext.getCmp(id); 通过id获取组件。Ext.get(id) 通过id获取dom元素,与document.getElementById()一样。5布局l Accordion(折叠布局)见accordion.htmll Border布局分为east,south,west,north,center5个部分。任何border布局必须含有一个region:center位置如果有West或者east必须指定宽度,剩下的就是center宽度。如果有north或者south必须制定高度,剩下的高度就是center高度 见border.hmtll Hbox水平盒子布局按水平方向摆放,宽度用flex或者width表示。Width为固定宽度,flex为减去width宽度后的百分比 见hbox.html l Vbox垂直盒子布局 6.表单Ext.form.FormPanela) 表单基本组件见filedTypes.htmlb) 表单验证 vtype7Ajax请求Ext.Ajax.request( url: page.php, /请求连接地址 params: id: 1 /传递参数 , success: function(response) /请求成功后执行方法 var text = response.responseText; / process server response here );补充例子:局部更新页面方法 Ext.onReady(function() var loader = Ext.get(info).getLoader(); loader.startAutoRefresh(1000, url : index.html, renderer :function(loader,resp,req) ); );8.数据模型Model 数据实体模型代表数据实体。定义实体,常用配置:fields,定义实体有哪些字段,定义一些方法。Ext.define(User, extend: Ext.data.Model, fields: name: name, type: string, name: age, type: int, name: phone, type: string, name: alive, type: boolean, defaultValue: true , changeName: function() var oldName = this.get(name), newName = oldName + The Barbarian; this.set(name, newName); );创建实体:var user = Ext.create(User, name : Conan, age : 24, phone: 555-555-5555);user.changeName();user.get(name); /returns Conan The BarbarianAssociations模型关联,不常用Ext.define(Post, extend: Ext.data.Model, fields: id, user_id, belongsTo: User, hasMany : model: Comment, name: comments);Ext.define(Comment, extend: Ext.data.Model, fields: id, user_id, post_id, belongsTo: Post);Ext.define(User, extend: Ext.data.Model, fields: id, hasMany: Post, model: Comment, name: comments );Validations 验证Ext.define(User, extend: Ext.data.Model, fields: name: name, type: string, name: age, type: int, name: phone, type: string, name: gender, type: string, name: username, type: string, name: alive, type: boolean, defaultValue: true , validations: type: presence, field: age, type: length, field: name, min: 2, type: inclusion, field: gender, list: Male, Female, type: exclusion, field: username, list: Admin, Operator, type: format, field: username, matcher: /(a-z+)0-92,3/ );var instance = Ext.create(User, name: Ed, gender: Male, username: edspencer);var errors = instance.validate();Store 数据集 保存model对象的客户端缓存,提供了数据的过滤,排序,查找。var store = Ext.create(Ext.data.Store, autoLoad: true, model: User, proxy: type: ajax, url : users.json, reader: type: json, root: users );Proxy 数据代理用来处理数据的获取和保存。Types of ProxyThere are two main types of Proxy -ClientandServer. The Client proxies save their data locally and include the following subclasses: LocalStorageProxy- saves its data to localStorage if the browser supports it SessionStorageProxy- saves its data to sessionStorage if the browsers supports it MemoryProxy- holds data in memory only, any data is lost when the page is refreshedThe Server proxies save their data by sending requests to some remote server. These proxies include: Ajax- sends requests to a server on the same domain JsonP- uses JSON-P to send requests to a server on a different domain Direct- usesExt.direct.Managerto send requestsProxies operate on the principle that all operations performed are either Create, Read, Update or Delete. These four operations are mapped to the methodscreate,read,updateanddestroyrespectively. Each Proxy subclass implements these functions.Base class for any client-side storage. Used as a superclass forMemoryandWeb Storageproxies. Do not use directly, use one of the subclasses instead.Ext.data.proxy.Memory读取数据到内存,页面刷新,数据丢失。/this is the model we will be using in the storeExt.define(User, extend: Ext.data.Model, fields: name: id, type: int, name: name, type: string, name: phone, type: string, mapping: phoneNumber );/this data does not line up to our model fields - the phone field is called phoneNumbervar data = users: id: 1, name: Ed Spencer, phoneNumber: 555 1234 , id: 2, name: Abe Elias, phoneNumber: 666 1234 ;/note how we set the root in the reader to match the data structure abovevar store = Ext.create(Ext.data.Store, autoLoad: true, model: User, data : data, proxy: type: memory, reader: type: json, root: users );其他客户端proxy ,不常用,想了解去官网查看。Ext.data.proxy.AjaxExt.define(User, extend: Ext.data.Model, fields: id, name, email);/The Store contains the AjaxProxy as an inline configurationvar store = Ext.create(Ext.data.Store, model: User, proxy: type: ajax, url : users.json );store.load();其他服务器端不常用。ReaderWriter 数据读写器用于读取原始数据到model实体模型,或者将model实体模型格式化为指定的数据格式Reader 将代理读取到的原始数据按照不同规则解析,将解析后的数据放到模型对象中,常见的是json.Ext.define(User, extend: Ext.data.Model, fields: id, name, email);var store = Ext.create(Ext.data.Store, model: User, proxy: type: ajax, url : users.json, reader: type: json );简单数据格式 id: 1, name: Ed Spencer, email: ed , id: 2, name: Abe Elias, email: abe 自定义数据格式reader: type: json, root: users users: id: 1, name: Ed Spencer, email: ed , id: 2, name: Abe Elias, email: abe 定位读取位置:resordreader: type : json, root : users, record: user total: 122, offset: 0, users: id: ed-spencer-1, value: 1, user: id: 1, name: Ed Spencer, email: ed writer 将代理提交到服务端数据进行编码,常见的是json. 了解下就可以了。9.grid组件Ext.grid.Panel主要由两部分组成:处理数据的store,用于渲染表头的columnsExt.create(Ext.data.Store, storeId:simpsonsStore, fields:name, email, phone, data:items: name: Lisa, email:lisa, phone:555-111-1224 , name: Bart, email:bart, phone:555-222-1234 , name: Homer, email:home, phone:555-222-1244 , name: Marge, email:marge, phone:555-222-1254 , proxy: type: memory, reader: type: json, root: items );Ext.create(Ext.grid.Panel, title: Simpsons, store: Ext.data.StoreManager.lookup(simpsonsStore), columns: header: Name, dataIndex: name , header: Email, dataIndex: email, flex: 1 , header: Phone, dataIndex: phone , height: 200, width: 400, renderTo: Ext.getBody()10.tree组件第三章 项目整体结构3.1、代码结构 l 项目按模块划分l 每个模块对应三层结构Mapper:持久层 下面的包按该模块涉及到实体划分 以Dao为后缀的是hibernate的DAO接口层 以DaoImpl为后缀的是DAO的实现类 以Mapper为后缀的是ibatis接口Service:业务层 以Service为后缀的是hibernate的业务层接口 以ServiceImpl为后缀的是业务层接口的实现类Web:控制层 以Action为后缀是struts2的actionl 三层接口和类的名称严格按照以上后缀编写l 下面为实际例子中代码结构示意图: Action 代码说明:public void add() 新增一个实体public void updateUI() 返回要修改的实体,传递到修改界面public void update() 修改实体public void delete() 删除实体public void pageQueryByHibernate() 分页查询getresponse().setCharacterEncoding(UTF-8); /设置为utf-8编码extjspage.setStart(start); /前端传递过来 开始记录extjspage.setLimit(limit); /前端传递过来 每页显示几条记录extjspage.setTotalCount(this.userService.queryUserCount(); /设置记录总数量StringBuilder whereHql = new StringBuilder(); /构造where条件语句LinkedList params = new LinkedList(); /构造where条件参数值if (null != user.getAddress() & !user.getAddress().equals() whereHql.append( o.address like ?);params.add(% + user.getAddress() + %);extjspage.setResult(this.userService.queryUsers(start, limit,whereHql.toString(), params.toArray(); JsonUtils.write(extjspage, getresponse().getWriter(); /把封装分页结果传递给前台startIndex :起始记录maxResult :每页显示记录数whereHQL : where条件语句 如 o.address like ? o为实体别名,address为实体属性。O之前必须有一个空格,名字不能变,比如a.address 则不能识别params :where条件语句中值orderby : 排序 使用方法 LinkedHashMap orderby = new LinkedHashMap();orderby.put(order, desc);List query(final int startIndex, final int maxResult,final String whereHQL, final Object params,final LinkedHashMap orderby)List query(int startIndex, int maxResult, String whereHQL,Object params);List query(int startIndex, int maxResult,LinkedHashMap orderby);List query(int startIndex, int maxResult);List query();/* * 把bean转换成json字符串,并写入writer. * * param bean * 实例 * param writer * 输出流 * param excludes * 不使用json-lib转换的字段 * param datePattern * 日期转换格式 * throws Exception * 可能抛出任何异常 */JsonUtils.write(bean, writer, excludes, datePattern) 往前台发送json对象第四章 CODEFLY使用说明4.1、使用说明l 该框架依赖:修改bulid.properties中工程目录为现有项目具体实际绝对路径,如下:#工程目录projectPath =D:zxworkplaceqxgll 生成步骤:1, 在中,配置实体名称,如:2, 右键,选择run as,选择第二个ant build,弹出界面选择flycode,以后只要选择第一个ant build即可。
展开阅读全文
相关资源
相关搜索

最新文档


当前位置:首页 > 图纸设计 > 任务书类


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!