求JSP动态网页,能实现数据增删改查就行,不需要太复杂。。。 只要数据增删改查代码

只要数据增删改查代码有的话,发到704741304@qq.com。急!!!谢谢啦... 只要数据增删改查代码
有的话, 发到704741304@qq.com。
急!!!
谢谢啦
展开
 我来答
死妮子疙瘩
2011-03-03
知道答主
回答量:5
采纳率:0%
帮助的人:0
展开全部
package com.fourflower.bean;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

import com.fourflower.login.LoginBacking;
import com.fourflower.tools.Tool;
/**
*
* @author juyang
*
*/

public class AccoutSettingBean {

private ArrayList<AccoutSetting> asbList;

private String ALterCodeMsg;//结算方式代码提示信息
private boolean codeRender =false;//

private String ALterNameMsg;//结算方式名称提示信息
private boolean nameRender =false;//

private String ALterMsg;//添加成功与否
private boolean enRender =false;//

public String checkuser="";
String user_power ="";

public AccoutSettingBean(){
this.asbList = new ArrayList<AccoutSetting>();
seletASBean();
}

// public int getTotal() {
// int total = 0;
// Connection conn = Tool.getConnection("localhost","sa","sa");
//
// try {
// PreparedStatement pre = conn.prepareStatement("select count(*) as num from TDZ_JSMODE");
//
// ResultSet rs = pre.executeQuery();
//
// if(rs.next()){
// total = rs.getInt(1);
// }
// } catch (SQLException e) {
//
// e.printStackTrace();
// }finally{
//
// }
//
// return total;
// }
/**
* 查询所有记录
* @return
*/
public ArrayList<AccoutSetting> seletASBean(){
ArrayList<AccoutSetting> aList = new ArrayList<AccoutSetting>();
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;

con = Tool.getConnect("HDZSYSDB","sa","sa");//
try {
ps = con.prepareStatement("select * from TDZ_JSMODE");
rs = ps.executeQuery();
while(rs.next()){
AccoutSetting asbean = new AccoutSetting();
asbean.setSettleWayCode(rs.getString("MODECODE"));
asbean.setSettleWayName(rs.getString("MODENAME"));
aList.add(asbean);
}
} catch (SQLException e) {
e.printStackTrace();
}
finally{
try{
if(ps != null){
ps.close();
}
if(con !=null){
con.close();
}
}
catch (SQLException e){
e.printStackTrace();
}
}
this.asbList = aList;
return aList;
}

/**
*
* 删除某条记录
* @return
*/

public String deleteItem(){
user_power = LoginBacking.userPower;
if("普通用户".equals(user_power.trim()))
{
checkuser = "error";

}else{

for(int i=0;i<asbList.size();i++){
if (asbList.get(i).isSelected()) {
this.deleteItem(asbList.get(i).getSettleWayCode());
}
}
checkuser="";

}
return checkuser;
}

public boolean deleteItem(String code){
// String code = "";
// for(int i =0;i<asbList.size();i++){
// if(asbList.get(i).isSelected());{
// System.out.println(i);
// code = asbList.get(i).settleWayCode;
// }
// }
// System.out.println(code);

boolean flag = false;
Connection con = null;
PreparedStatement ps = null;

try {
//
con = Tool.getConnect("HDZSYSDB","sa","sa");
//
ps = con.prepareStatement("delete from TDZ_JSMODE where MODECODE=?");
//
ps.setString(1, code);
//
int i = ps.executeUpdate();
//
if(i == 1) {

flag = true;
// this.asbList = asbList;
this.seletASBean();
}
} catch (SQLException e) {
e.printStackTrace();
}
//
finally{
try {
if(ps != null) {
ps.close();
}
if(con != null) {
con.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
//
return flag;

}

public ArrayList<AccoutSetting> getAsbList() {
return asbList;
}
public void setAsbList(ArrayList<AccoutSetting> asbList) {
this.asbList = asbList;
}

public String getALterCodeMsg() {
return ALterCodeMsg;
}

public void setALterCodeMsg(String lterCodeMsg) {
ALterCodeMsg = lterCodeMsg;
}

public boolean isCodeRender() {
return codeRender;
}

public void setCodeRender(boolean codeRender) {
this.codeRender = codeRender;
}

public String getALterNameMsg() {
return ALterNameMsg;
}

public void setALterNameMsg(String lterNameMsg) {
ALterNameMsg = lterNameMsg;
}

public boolean isNameRender() {
return nameRender;
}

public void setNameRender(boolean nameRender) {
this.nameRender = nameRender;
}

public String getALterMsg() {
return ALterMsg;
}

public void setALterMsg(String lterMsg) {
ALterMsg = lterMsg;
}

public boolean isEnRender() {
return enRender;
}

public void setEnRender(boolean enRender) {
this.enRender = enRender;
}

public String getCheckuser() {
return checkuser;
}

public void setCheckuser(String checkuser) {
this.checkuser = checkuser;
}

public String getUser_power() {
return user_power;
}

public void setUser_power(String user_power) {
this.user_power = user_power;
}

}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2011-03-01
展开全部
我有个程序是用sturst2.0做的行吗?可以增删改查,还有分页。。。。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式