title: JSP頁面查詢顯示常用模式
author: evan
email: evan_zhao@hotmail
背景
問題
通過JDBC ResultSet可獲取查詢結果(存在於數據庫緩沖區內)
解決方法一
使用Value Object
示例代碼
- //查詢數據代碼
- Connection conn = DBUtil
getConnection(); - PreparedStatement pst = null;
- ResultSet rs = null;
- try{
- String sql=“select emp_code
real_name from t_employee where organ_id=?”; - pst = conn
preparedStatement(sql); - pst
setString( “ ”); - ResultSet rs = pst
executeQuery(); - List list = new ArrayList();
- Employee emp;
- while (rs
next()){
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20635.html