package hh.doit;
import hh.doit.*;
import hh.bean.*;
import hh.connection.*;
import java.util.*;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.sql.*;
public class caozuo {
public void add(Conn m) {
Connection conn = DBManger.getConnection();
String sql = "insert into liuyanban(ID,name,email,subject) values(?,?,?,?)";
try {
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, m.getID());
ps.setString(2, m.getName());
ps.setString(3, m.getEmail());
ps.setString(4, m.getSubject());
ps.executeUpdate();
ps.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void delete(String id) {
Connection conn = DBManger.getConnection();
String sql = "delete from liuyanban where ID=?";
try {
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, id);
pstmt.executeUpdate();
pstmt.close();
} catch (SQLException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
} finally {
try {
conn.close();
} catch (SQLException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
}
}
}
public List getEmps() {
Connection conn = DBManger.getConnection();
List list = new ArrayList();
String sql = "select * from liuyanban";
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
Conn e = new Conn();
e.setID(rs.getString("ID"));
e.setName(rs.getString("name"));
e.setEmail(rs.getString("email"));
e.setSubject(rs.getString("subject"));
list.add(e);
}
rs.close();
stmt.close();
} catch (SQLException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
} finally {
try {
conn.close();
} catch (SQLException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
}
}
return list;
}
public Conn findById(String id) {
Connection conn = DBManger.getConnection();
Conn e = null;
String sql = "select * from liuyanban where ID=?";
try {
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, id);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
e = new Conn();
e.setID(rs.getString("ID"));
e.setName(rs.getString("name"));
e.setEmail(rs.getString("email"));
e.setSubject(rs.getString("subject"));
}
rs.close();
pstmt.close();
} catch (SQLException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
} finally {
try {
conn.close();
} catch (SQLException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
}
}
return e;
}
public List selectbylike(String ID) {
String sql = "select * from liuyanban where ID like ?";
Connection conn = new DBManger().getConnection();
ID = "%" + ID + "%";
List list = new ArrayList();
try {
PreparedStatement psmt = conn.prepareStatement(sql);
psmt.setString(1, ID);
ResultSet rs = psmt.executeQuery();
while (rs.next()) {
Conn selb2 = new Conn();
selb2.setID(rs.getString(1));
selb2.setName(rs.getString(2));
selb2.setEmail(rs.getString(3));
selb2.setSubject(rs.getString(4));
list.add(selb2);
}
rs.close();
System.out.println("传递成功!!!!!");
psmt.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
public void update(Conn e) {
Connection conn = DBManger.getConnection();
String sql = "update liuyanban set name=?,email=?,subject=? where ID=?";
try {
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, e.getName());
pstmt.setString(2, e.getEmail());
pstmt.setString(3, e.getSubject());
pstmt.setString(4, e.getID());
pstmt.executeUpdate();
pstmt.close();
} catch (SQLException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
} finally {
try {
conn.close();
} catch (SQLException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
留言板eclipse做的一个留言板
共103个文件
prefs:51个
xml:10个
jsp:10个
4星 · 超过85%的资源 需积分: 33 77 下载量 24 浏览量
2009-01-04
14:16:45
上传
评论 1
收藏 65KB RAR 举报
温馨提示
eclipse做的一个留言板,可以很好的帮助刚做的同学们 可以去看看
资源推荐
资源详情
资源评论
收起资源包目录
留言板eclipse做的一个留言板 (103个子文件)
caozuo.class 5KB
logic_servlet.class 3KB
login_servlet.class 2KB
Servlet.class 2KB
login_logic.class 1KB
show_servlet.class 1KB
Conn.class 1KB
DBManger.class 886B
login_conn.class 845B
.classpath 340B
variablesAndContainers.dat 525B
properties.index 57B
version.ini 26B
caozuo.java 4KB
logic_servlet.java 3KB
login_servlet.java 2KB
Servlet.java 2KB
show_servlet.java 1KB
Conn.java 815B
login_logic.java 745B
DBManger.java 519B
login_conn.java 436B
add.jsp 2KB
showall.jsp 2KB
select.jsp 1KB
del.jsp 1KB
field.jsp 1KB
update.jsp 937B
login.jsp 806B
show.jsp 620B
selectbylike.jsp 535B
show_action.jsp 35B
.lock 0B
.log 3KB
hibernate-tools.log 0B
MANIFEST.MF 39B
.mymetadata 300B
org.eclipse.ui.workbench.prefs 1KB
com.genuitec.eclipse.wizards.prefs 1KB
org.eclipse.jdt.core.prefs 738B
com.genuitec.eclipse.jsf.prefs 564B
org.eclipse.jdt.launching.prefs 509B
org.eclipse.jdt.ui.prefs 426B
org.eclipse.ui.ide.prefs 128B
com.genuitec.eclipse.easie.weblogic.prefs 97B
com.genuitec.eclipse.easie.sun81.prefs 97B
com.genuitec.eclipse.easie.jonas3.prefs 97B
com.genuitec.eclipse.easie.websphere6.prefs 97B
com.genuitec.eclipse.easie.jonas.prefs 97B
com.genuitec.eclipse.easie.jboss.prefs 97B
com.genuitec.eclipse.easie.tomcat6.prefs 97B
com.genuitec.eclipse.easie.tomcat.prefs 97B
com.genuitec.eclipse.easie.core.prefs 97B
com.genuitec.eclipse.easie.sun.prefs 97B
com.genuitec.eclipse.easie.sunglassfish.prefs 97B
com.genuitec.eclipse.easie.orion2.prefs 97B
com.genuitec.eclipse.easie.websphere61.prefs 97B
com.genuitec.eclipse.easie.weblogic7.prefs 97B
com.genuitec.eclipse.easie.oracle.prefs 97B
com.genuitec.eclipse.easie.oracle9.prefs 97B
com.genuitec.eclipse.easie.jboss4.prefs 97B
com.genuitec.eclipse.easie.jboss3.prefs 97B
com.genuitec.eclipse.easie.jetty4.prefs 97B
com.genuitec.eclipse.easie.sun8.prefs 97B
com.genuitec.eclipse.easie.resin3.prefs 97B
com.genuitec.eclipse.easie.bejy.prefs 97B
com.genuitec.eclipse.easie.jonas4.prefs 97B
com.genuitec.eclipse.easie.resin2.prefs 97B
com.genuitec.eclipse.easie.jboss2.prefs 97B
com.genuitec.eclipse.easie.jrun.prefs 97B
com.genuitec.eclipse.easie.websphere5.prefs 97B
com.genuitec.eclipse.easie.jrun4.prefs 97B
com.genuitec.eclipse.easie.weblogic6.prefs 97B
com.genuitec.eclipse.easie.resin.prefs 97B
com.genuitec.eclipse.easie.tomcat5.prefs 97B
com.genuitec.eclipse.easie.weblogic9.prefs 97B
com.genuitec.eclipse.easie.tomcat4.prefs 97B
com.genuitec.eclipse.easie.orion1.prefs 97B
com.genuitec.eclipse.easie.jetty5.prefs 97B
com.genuitec.eclipse.easie.websphere.prefs 97B
com.genuitec.eclipse.easie.weblogic8.prefs 97B
com.genuitec.eclipse.easie.geronimo1.prefs 97B
com.genuitec.eclipse.easie.sun9.prefs 97B
com.genuitec.eclipse.easie.jetty.prefs 97B
com.genuitec.myeclipse.compatibility.prefs 88B
com.genuitec.eclipse.hibernate.prefs 83B
org.eclipse.ui.prefs 79B
org.eclipse.core.resources.prefs 73B
.project 1KB
org.eclipse.core.resources 319B
1.tree 77B
history.version 1B
properties.version 1B
user.xml 224KB
workbench.xml 16KB
dialog_settings.xml 3KB
web.xml 2KB
libraryInfos.xml 830B
dialog_settings.xml 358B
dialog_settings.xml 131B
共 103 条
- 1
- 2
资源评论
- 禁弓止鸟2014-06-26没有数据库啊
- QQSCR2014-02-06还不错,就是没数据库文件
- mikegxy62014-06-17是用myeclipse做的
xu7778899
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功