select对应的action

package action;
import java.sql.*;
import com.opensymphony.xwork2.ActionSupport;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import db.DBConn;
import POJO.Msg_stand;
import java.util.ArrayList;
import java.util.Map;

public class select extends ActionSupport {

private int send_uid;//发件人
private String subject;//主题
private String create_time;//发件时间
public String action;//操作类型


public int getSend_uid() {
return send_uid;
}
public void setSend_uid(int send_uid) {
this.send_uid = send_uid;
}

public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}

public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
@Override
public String execute()throws Exception{
Connection conn=DBConn.createDBConn();
if("del".equals(action)){
String sql="delete from msg_stand where send_uid=?";
PreparedStatement preSQLDel=conn.prepareStatement(sql);
preSQLDel.setInt(1,send_uid);
preSQLDel.executeUpdate();

}

else{
String sql="select subject,send_uid,create_time from msg_stand where send_uid=?";
PreparedStatement preSQLSel=conn.prepareStatement(sql);
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
preSQLSel.setInt(1, send_uid);
//preSQLSel.executeQuery(sql);
ArrayList<Msg_stand> msg_standArrayList=new ArrayList<Msg_stand>();

while(rs.next()){
Msg_stand msg_stand =new Msg_stand();
msg_stand.setSend_uid(rs.getInt("send_uid"));
msg_stand.setSubject(rs.getString("subject"));
msg_stand.setCreate_time(rs.getString("create_time"));
msg_standArrayList.add(msg_stand);
}

}
return SUCCESS;
}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值