SSI+Jquery实现增删改查(无刷新).doc
《SSI+Jquery实现增删改查(无刷新).doc》由会员分享,可在线阅读,更多相关《SSI+Jquery实现增删改查(无刷新).doc(24页珍藏版)》请在三一办公上搜索。
1、 SSI+jquery简单增删改查一、 配置环境加入jar包,我以前写过一个文档,里面已经将jar包写好,请参考:除了将这些jar包加入后,还得需要几个包,这几个包是jquery所要用到的包commons-beanutils-1.8.3.jar、commons-collections-3.2.1.jar、commons-lang-2.5.jar、commons-logging.jar、dwr4struts2.jar、ezmorph-1.0.6.jar、json-lib-2.2.2-jdk15.jar、jsonplugin-0.31.jar二、 编写后台代码及配置文件1、 写实体beanStud
2、ent.javapackage com.vstsoft.model;public class Studentprivate int id ;private String username ;private String stuid ;private String email ;private String phone ;private String address ;public int getId() return id;public void setId(int id) this.id = id;public String getUsername() return username;pub
3、lic void setUsername(String username) this.username = username;public String getStuid() return stuid;public void setStuid(String stuid) this.stuid = stuid;public String getEmail() return email;public void setEmail(String email) this.email = email;public String getPhone() return phone;public void set
4、Phone(String phone) this.phone = phone;public String getAddress() return address;public void setAddress(String address) this.address = address;2、 编写dao层及其实现StudentDao.javapackage com.vstsoft.dao;import java.util.List;import com.vstsoft.model.Student;public interface StudentDao public List queryAll()
5、;/查询全部public boolean save(Student student) ;/增加public boolean del(int id) ;/删除public boolean update(Student student) ;/更新public Student queryById(int id);/按ID查询StudentDaoImpl.javapackage com.vstsoft.dao.impl;import java.sql.SQLException;import java.util.List;import com.ibatis.sqlmap.client.SqlMapCli
6、ent;import com.vstsoft.dao.StudentDao;import com.vstsoft.model.Student;public class StudentDaoImpl extends Student implements StudentDao private SqlMapClient sqlMapClient;public void setSqlMapClient(SqlMapClient sqlMapClient) this.sqlMapClient = sqlMapClient;public boolean del(int id) try int b = sq
7、lMapClient.delete(del, id);if(b0)return true;elsereturn false; catch (SQLException e) e.printStackTrace();return false;public List queryAll() List list = null;try list = sqlMapClient.queryForList(queryAll); catch (SQLException e) e.printStackTrace();return list;public Student queryById(int id) Stude
8、nt student = null;try student = (Student) sqlMapClient.queryForObject(queryById, id); catch (SQLException e) e.printStackTrace();return student;public boolean save(Student student) boolean b ;try sqlMapClient.insert(saveStu, student);b = true ; catch (SQLException e) e.printStackTrace();b = false;re
9、turn b ;public boolean update(Student student) boolean b ;try sqlMapClient.update(updateStu, student);b = true; catch (SQLException e) e.printStackTrace();b = false;return b;3、 编写服务层及其实现StudentService.javapackage com.vstsoft.service;import java.util.List;import com.vstsoft.model.Student;public inter
10、face StudentService public List queryAll();/查询全部public boolean save(Student student) ;/增加public boolean del(int id) ;/删除public boolean update(Student student) ;/更新public Student queryById(int id);/按ID查询StudentServiceImpl.javapackage com.vstsoft.service.impl;import java.util.List;import com.vstsoft.d
11、ao.StudentDao;import com.vstsoft.model.Student;import com.vstsoft.service.StudentService;public class StudentServiceImpl implements StudentService private StudentDao sdao ;public boolean del(int id) boolean b = sdao.del(id);if(b)return true ;elsereturn false;public List queryAll() List list = sdao.q
12、ueryAll();return list;public Student queryById(int id) Student student = sdao.queryById(id);return student;public boolean save(Student student) boolean b = sdao.save(student);if(b)return true;elsereturn false;public boolean update(Student student) boolean b = sdao.update(student);if(b)return true;el
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- SSI Jquery 实现 增删 刷新
链接地址:https://www.31ppt.com/p-2395041.html