ShowMail.java
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:1k
- package com.softeem.webmail.send;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.List;
- import com.softeem.webmail.dao.DBManager;
- import com.softeem.webmail.sendbox.SendboxBean;
- public class ShowMail {
- public List select(int id) {
- Connection con = DBManager.getConnection();
- String sql = "select *from mail where id = ? ";
- ResultSet rs = null;
- List list = new ArrayList();
- PreparedStatement ps;
- try {
- ps = con.prepareStatement(sql);
- ps.setInt(1, id);
- rs = ps.executeQuery();
- while (rs.next()) {
- SendboxBean pf = new SendboxBean();
- pf.setId(rs.getInt("id"));
- pf.setMail_from(rs.getString("mail_from"));
- pf.setMail_to(rs.getString("mail_to"));
- pf.setSubject(rs.getString("subject"));
- pf.setContent(rs.getString("content"));
- pf.setDate(rs.getString("date"));
- pf.setSize(rs.getFloat("size"));
- pf.setStat(rs.getString("stat"));
- pf.setAdds(rs.getString("adds"));
- list.add(pf);
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return list;
- }
- }