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;
}
}
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;
}
}