资源简介
jsf实现的增删改查小示范,大家共同学习进步
代码片段和文件信息
package com.demo.bean;
import java.util.ArrayList;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import com.demo.dao.StudentDAO;
import com.demo.entity.Student;
public class StuOptBean
{
private Integer stuId;
private String stuName = ““;
private Integer stuAge;
private String stuAddress = ““;
private StudentDAO stuDAO = new StudentDAO();
private List stuList = new ArrayList();
public StudentDAO getStuDAO()
{
return stuDAO;
}
public void setStuDAO(StudentDAO stuDAO)
{
this.stuDAO = stuDAO;
}
public String getStuAddress()
{
return stuAddress;
}
public void setStuAddress(String stuAddress)
{
this.stuAddress = stuAddress;
}
public Integer getStuAge()
{
return stuAge;
}
public void setStuAge(Integer stuAge)
{
this.stuAge = stuAge;
}
public Integer getStuId()
{
return stuId;
}
public void setStuId(Integer stuId)
{
this.stuId = stuId;
}
public String getStuName()
{
return stuName;
}
public void setStuName(String stuName)
{
this.stuName = stuName;
}
public List getStuList()
{
stuList = stuDAO.findAll();
return stuList;
}
public void setStuList(List stuList)
{
this.stuList = stuList;
}
//查询单条记录方法
public String selById()
{
try
{
FacesContext ctx = FacesContext.getCurrentInstance();
String stuId = (String)ctx.getExternalContext().getRequestParameterMap().get(“stuId“);
Student student = stuDAO.findById(Integer.parseInt(stuId));
if (student != null)
{
this.setStuId(student.getStuId());
this.setStuName(student.getStuName());
this.setStuAge(student.getStuAge());
this.setStuAddress(student.getStuAddress());
}
}
catch (Exception e)
{
return “error“;
}
return “update“;
}
//插入数据方法
public String insert()
{
try
{
Student student = new Student();
student.setStuId(this.getStuId());
student.setStuName(this.getStuName());
student.setStuAge(this.getStuAge());
student.setStuAddress(this.getStuAddress());
stuDAO.save(student);
}
catch(Exception e)
{
return “error“;
}
return “main“;
}
//更新数据方法
public String update()
{
try
{
Student student = new Student();
student.setStuId(this.getStuId());
student.setStuName(this.getStuName());
student.setStuAge(this.getStuAge());
student.setStuAddress(this.getStuAddress());
int i = stuDAO.update(student);
}
catch(Exception e)
{
return “error“;
}
return “main“;
}
//删除数据方法
public String delete()
{
try
{
FacesContext ctx = FacesContext.getCurrentInstance();
String stuId = (String)ctx.getExternalContext().getRequestParameterMap().get(“stuId“);
int i = stuDAO.delete(Integer.parseInt(stuId));
}
catch(Exception e)
{
return “error“;
}
return “main“;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3178 2008-09-28 14:09 DemoByWukewei\.classpath
文件 487 2008-09-28 14:09 DemoByWukewei\.myhibernatedata
文件 312 2008-09-28 14:09 DemoByWukewei\.myme
文件 1616 2008-09-28 14:09 DemoByWukewei\.project
文件 7165 2008-09-28 14:09 DemoByWukewei\build.xm
文件 512707 2008-09-28 14:09 DemoByWukewei\DemoByWukewei\WebRoot\WEB-INF\lib\mysql.jar
文件 508 2008-09-28 14:09 DemoByWukewei\mysql.sql
文件 3028 2008-09-28 14:09 DemoByWukewei\src\com\demo\bean\StuOptBean.java
文件 2350 2008-09-28 14:09 DemoByWukewei\src\com\demo\dao\StudentDAO.java
文件 924 2008-09-28 14:09 DemoByWukewei\src\com\demo\entity\Student.hbm.xm
文件 1140 2008-09-28 14:09 DemoByWukewei\src\com\demo\entity\Student.java
文件 3072 2008-09-28 14:09 DemoByWukewei\src\com\demo\hibernate\HibernateSessionFactory.java
文件 910 2008-09-28 14:09 DemoByWukewei\src\hibernate.cfg.xm
文件 308 2008-09-28 14:09 DemoByWukewei\WebRoot\error.jsp
文件 216 2008-09-28 14:09 DemoByWukewei\WebRoot\index.jsp
文件 1191 2008-09-28 14:09 DemoByWukewei\WebRoot\insert.jsp
文件 1779 2008-09-28 14:09 DemoByWukewei\WebRoot\main.jsp
文件 39 2008-09-28 14:09 DemoByWukewei\WebRoot\me
文件 1388 2008-09-28 14:09 DemoByWukewei\WebRoot\update.jsp
文件 1797 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\.faces-config.mex
文件 10763 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\c-1_0-rt.tld
文件 11310 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\c-1_0.tld
文件 15999 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\c.tld
文件 3674 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\classes\com\demo\bean\StuOptBean.class
文件 3378 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\classes\com\demo\dao\StudentDAO.class
文件 1396 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\classes\com\demo\entity\Student.class
文件 924 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\classes\com\demo\entity\Student.hbm.xm
文件 2406 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\classes\com\demo\hibernate\HibernateSessionFactory.class
文件 910 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\classes\hibernate.cfg.xm
文件 1618 2008-09-28 14:09 DemoByWukewei\WebRoot\WEB-INF\faces-config.xm
............此处省略80个文件信息
相关资源
- jsf2.0详细文档
- JSF框架的demo项目
- seam经典教程含
- JSF学习--比萨(pizza)订购系统
- eclipse+JSF开发配置图解
- jsf增删改crud源码crud
- JSF写的数据库增删改查
- Spring+Hibernate+JSF整合,完整购物系统源
- JSF登录的 Eclipse
- Jsf增删改查实例102936
- 拍卖系统jsf+ejb+jpa
- jsf+richfaces+hiberante项目源码(个人日志
- JSF,涵盖了所有JSF学习内容
- jsf1.2+spring3.0+hibernate3.3-单表增删改查
- 在线就业管理系统(JSF+Hibernate)
- JSF二次输入密码答案
- jsf+spring+hibernate整合demo
- jsf订单界面
- jsf增删改查
- flash元件批量改名命令jsfl
- 学生成绩管理系统_JSF
- jsf增删改查分页
- 基于JSF的毕业设计管理系统
- JSF Web 应用开发实战源码
- jsf介绍和
- 《JSF入门》培训教程PPT
评论
共有 条评论