求个form表单建立和提交 (With JSP)实例

来源:百度知道 编辑:UC知道 时间:2024/06/23 16:54:09
form表单建立和提交 (With JSP)

包括 表单添加
表单修改
表单删除
(来几个实例,最好是oracle库 struts框架的。)
用的myeclipse哦。jsp页面。

好了还加分!

这个要用到数据库语句,如下
/**
* 操作-----增 向数据库中插入一条新闻,传入News对象
*
* @param news
* @return
*/
public int insertNews(News news) {
Connection conn = null;
PreparedStatement ps = null;

int num = 0;

try {
conn = super.getConnection();
String sqlStr = "insert into NEWS values (?,?,?)";
ps = conn.prepareStatement(sqlStr);
ps.setString(1, news.getTitle());
ps.setString(2, news.getCont());
ps.setString(3, news.getCreater());
num = ps.executeUpdate();
} catch (SQLException e) {

e.printStackTrace();
} finally {
super.closeAll(conn, ps, null);
}
return num;
}

/**
* 操作----删
*
* @param id
* @return
*/
public int deleteNews(int id) {
Connection conn = null;
PreparedStatement ps = null;

int num = 0;

try {
c