




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Struts2整合 Gt-Grid 增删改查 - JAVA 先看效果图:departManager.jsp代码:href=gt-grid/gt_grid.css /Action 代码: import dao.DepartDao;import form.Depart;public class DepartAction extends ActionSupport Overridepublic String execute( throws Exception JSONObject jsonObj = JSONObject.fromObject(this._gt_json;String action
2、= jsonObj.getString(action;if (action.equals(save for (int i = 0; i jsonObj.getJSONArray(updatedRecords.size(; i+ Depart depart = (Depart JSONObject.toBean(jsonObj.getJSONArray(updatedRecords.getJSONObject(i,Depart.class;new DepartDao(.updateDepart(depart;for (int i = 0; i jsonObj.getJSONArray(inser
3、tedRecords.size(; i+ Depart depart = (Depart JSONObject.toBean(jsonObj .getJSONArray(insertedRecords.getJSONObject(i, Depart.class;new DepartDao(.insertDepart(depart;for (int i = 0; i jsonObj.getJSONArray(deletedRecords.size(; i+ Depart depart = (Depart JSONObject.toBean(jsonObj .getJSONArray(delete
4、dRecords.getJSONObject(i, Depart.class;new DepartDao(.deleteDepart(depart;if (action.equals(load departs = new DepartDao(.getAllDepart(;return SUCCESS;private static final long serialVersionUID = 1L;private String _gt_json;private List departs;JSON(name = datapublic List getDeparts( return departs;p
5、ublic void setDeparts(List departs this.departs = departs;public String get_gt_json( return _gt_json;public void set_gt_json(String _gt_json this._gt_json = _gt_json;struts.xml 配置:Depart.java代码: package form; public class Depart private int depart_id; private String depart_name;private int order_id;
6、 private int if_valid;public int getDepart_id( return depart_id;public void setDepart_id(int depart_id this.depart_id = depart_id;public String getDepart_name( return depart_name;public void setDepart_name(String depart_name this.depart_name = depart_name;public int getOrder_id( return order_id;publ
7、ic void setOrder_id(int order_id this.order_id = order_id;public int getIf_valid( return if_valid;public void setIf_valid(int if_valid this.if_valid = if_valid; DepartDao.java代码: 数据库持久层用的 IBATIS 。 package dao;import utils.SqlMapAnshan;import form.Depart;public class DepartDao private SqlMapClient sq
8、lMapClient;public DepartDao(this.sqlMapClient=SqlMapAnshan.getSqlMapInstance(; public DepartDao(SqlMapClient sqlMapClient this.sqlMapClient=sqlMapClient;public List getAllDepart(List list=null;try list=sqlMapClient.queryForList(depart.selectAllDepart; catch (SQLException e e.printStackTrace(;return
9、list;public int updateDepart(Depart departint i=0;try i=sqlMapClient.update(depart.updateDepartById, depart; catch (SQLException e e.printStackTrace(;return i;public void insertDepart(Depart departInteger i=0;try sqlMapClient.insert(depart.inertDepart, depart; catch (SQLException e e.printStackTrace(;public int deleteDepart(Depart departint i=0;try i=sqlMapClient.delete(depart.del
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 芝麻教育管理办法
- 湖南餐厅管理办法
- 软件中心管理办法
- 成都武侯区重点名校2026届初中语文毕业考试模拟冲刺卷含解析
- 2026届河北省保定市满城县中考数学考试模拟冲刺卷含解析
- 北京市2026届中考三模数学试题含解析
- 微重力生命保障-洞察及研究
- 支付纠纷解决机制-洞察及研究
- 林芝重点名校2026届中考物理模试卷含解析
- 基于图谱的身份关联-洞察及研究
- 电力采集系统培训课件
- 2025年“学宪法讲宪法”学法知识竞赛题库附答案
- 工会与家属活动方案
- 农村夜市活动方案
- 2025年福建省中考作文《未来总是甜的》写作指导及范文
- 丙酮安全管理制度
- 2025年湖北联投招聘笔试冲刺题(带答案解析)
- JG/T 174-2014建筑铝合金型材用聚酰胺隔热条
- 胎膜早破的护理
- 中国PVB膜项目创业计划书
- 锡林郭勒苏能白音华发电有限公司招聘笔试题库2025
评论
0/150
提交评论