标签:tac jsp bsp inf for 效果 tps next from
public class NewsMapperImpl implements NewsMapper { @Override public List<News> findAllNewsHref() { Connection conn = null; Statement statement = null; ResultSet rs = null; List<News> news = new ArrayList<>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { conn = DBUtil.getConnection(); statement = conn.createStatement(); String sql = "select * from news"; rs = statement.executeQuery(sql); while (rs.next()) { News nw = new News( rs.getInt(1), rs.getString(2), rs.getString(3), rs.getString(4), sdf.parse(rs.getString(5)) ); news.add(nw); } } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } return news; } }
效果:
码云地址:https://gitee.com/chaserff/J2EE.git
标签:tac jsp bsp inf for 效果 tps next from
原文地址:https://www.cnblogs.com/chaserFF/p/13130332.html