台州网络建站模板,管理系统是网站吗,销售订单管理系统,国际健康旅行码#x1f973;#x1f973;Welcome Huihuis Code World ! !#x1f973;#x1f973; 接下来看看由辉辉所写的关于Eclipse使用的相关操作吧 目录
#x1f973;#x1f973;Welcome Huihuis Code World ! !#x1f973;#x1f973; 一.导读
二.详细操作步骤 1.右击项… Welcome Huihuis Code World ! ! 接下来看看由辉辉所写的关于Eclipse使用的相关操作吧 目录
Welcome Huihuis Code World ! ! 一.导读
二.详细操作步骤 1.右击项目处点击import 2.选择所要导入的项目所在路径 3.导入项目完毕之后需要检查是否有错误 4.若报错则检查配置的文件是否出现了问题 5.将报错的文件移除掉 6.重新配置一个文件注意版本 7.项目不报错之后我们来看一下数据库辅助类编辑 8.核对账号密码的信息 9.再选择需要导入的对应数据库脚本
10.选择运行的jsp界面即可若成功运行则没有问题
11.我们再参照这个项目中的代码完成一个简单的增删改查
entity
dao
servlet
运行结果 一.导读
上篇我们已经详细介绍了开发工具eclipse也说明了eclipse的基本使用那么我们这篇来详细讲述一下怎么导入项目
二.详细操作步骤 1.右击项目处点击import 2.选择所要导入的项目所在路径 3.导入项目完毕之后需要检查是否有错误 4.若报错则检查配置的文件是否出现了问题 5.将报错的文件移除掉 6.重新配置一个文件注意版本 7.项目不报错之后我们来看一下数据库辅助类 8.核对账号密码的信息 9.再选择需要导入的对应数据库脚本 10.选择运行的jsp界面即可若成功运行则没有问题 11.我们再参照这个项目中的代码完成一个简单的增删改查 entity package com.wh.entity;public class Cat {
int cid;
String cname;
int age;public Cat() {// TODO Auto-generated constructor stub
}public Cat(int cid, String cname, int age) {super();this.cid cid;this.cname cname;this.age age;
}public int getCid() {return cid;
}public void setCid(int cid) {this.cid cid;
}public String getCname() {return cname;
}public void setCname(String cname) {this.cname cname;
}public int getAge() {return age;
}public void setAge(int age) {this.age age;
}Override
public String toString() {return Cat [cid cid , cname cname , age age ];
}}dao package com.wh.dao;import java.util.List;import com.zking.util.BaseDao;
import com.zking.util.PageBean;
import com.zking.util.StringUtils;public class CatDao extends BaseDaoCat{public ListCat list(Cat cat,PageBean pageBean) throws Exception{String sql select * from t_mvc_cat where 1 1 ;String title cat.getCname();int id cat.getCid();if(StringUtils.isNotBlank(title)) {sql and title like %title%;}if(id ! 0) {sql and cid id;}return super.executeQuery(sql, Cat.class, pageBean);}public void add(Cat cat) throws Exception {String sql insert into t_mvc_cat(cid,cname,age) values(?,?,?);super.executeUpdate(sql, cat, new String[] {cid,cname,age});}public void delete(Cat cat) throws Exception {String sql delete from t_mvc_cat where cid ?;super.executeUpdate(sql, cat, new String[] {cid});}public void edit(Cat cat) throws Exception {String sql update t_mvc_cat set cname ?,age ? where cid ?;super.executeUpdate(sql, cat, new String[] {cname,age,cid});}
}servlet package com.wh.web;import java.util.List;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import com.wh.dao.CatDao;
import com.zking.entity.Cat;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.PageBean;public class CatAction extends ActionSupport implements ModelDriverCat{public Cat cat new Cat();public CatDao catDao new CatDao();Overridepublic Cat getModel() {return cat;}public String list(HttpServletRequest req, HttpServletResponse resp) {
// 查数据库的PageBean pageBean new PageBean();pageBean.setRequest(req);try {ListCat list catDao.list(cat, pageBean);req.setAttribute(cats, list);req.setAttribute(pageBean, pageBean);} catch (Exception e) {e.printStackTrace();}return list;}public String add(HttpServletRequest req, HttpServletResponse resp) {try {catDao.add(cat);} catch (Exception e) {e.printStackTrace();}return toList;}public String delete(HttpServletRequest req, HttpServletResponse resp) {try {catDao.delete(cat);} catch (Exception e) {e.printStackTrace();}return toList;}public String edit(HttpServletRequest req, HttpServletResponse resp) {try {catDao.edit(cat);} catch (Exception e) {e.printStackTrace();}return toList;}public String toEdit(HttpServletRequest req, HttpServletResponse resp) {if(cat.getCid()! 0) {try {ListCat list catDao.list(cat, null);req.setAttribute(c, list.get(0));} catch (Exception e) {e.printStackTrace();}}return toEdit;}
}运行结果 好啦今天的分享就到这了希望能够帮到你呢