?? customerdao.java
字號:
package com.cric.onlineshopclothes.dao;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.cric.onlineshopclothes.javabean.Customer;
import com.cric.onlineshopclothes.util.DBUtils;
public class CustomerDAO {
public List getCustomerList(){
DBUtils db=new DBUtils();
ResultSet rs=null;
List list=new ArrayList();
String sqlStr="select * from customer";
try{
rs=db.excuteQuery(sqlStr);
while(rs.next()){
Customer customer=new Customer();
customer.setCId(rs.getInt("CId"));
customer.setCustomerName(rs.getString("customerName"));
customer.setSex(rs.getString("sex"));
customer.setCustomerPass(rs.getString("customerPass"));
customer.setAddress(rs.getString("address"));
customer.setEmail(rs.getString("email"));
customer.setContact(rs.getString("contact"));
list.add(customer);
}
}catch(Exception e){
e.printStackTrace();
}finally{
db.closeConnection();
}
return list;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -