摘要: //得到总记录数 public int getTotalrecord(){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "select count(*) from customer"; st = conn.prepareStatement(sql); ... 阅读全文
posted @ 2013-07-07 11:08 亂舞春秋 阅读(271) 评论(0) 推荐(0)
摘要: //获取分页数据 public List getPageData(int startindex,int pagesize){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "select * from customer limit ?,?"; st = conn.p... 阅读全文
posted @ 2013-07-07 11:06 亂舞春秋 阅读(292) 评论(0) 推荐(0)
摘要: public Customer find(String id){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "select * from customer where id=?"; st = conn.prepareStatement(sql); ... 阅读全文
posted @ 2013-07-07 11:05 亂舞春秋 阅读(209) 评论(0) 推荐(0)
摘要: public void delete(String id){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "delete from customer where id=?"; st = conn.prepareStatement(sql); st.... 阅读全文
posted @ 2013-07-07 11:04 亂舞春秋 阅读(236) 评论(0) 推荐(0)
摘要: public void update(Customer c){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "update customer set name=?,gender=?,birthday=?,cellphone=?,email=?,preference=?,type=?,desc... 阅读全文
posted @ 2013-07-07 11:03 亂舞春秋 阅读(247) 评论(0) 推荐(0)
摘要: public List getAll(){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection(); String sql = "select * from customer"; st = conn.prepareStatement(sql); rs = st.execu... 阅读全文
posted @ 2013-07-06 21:02 亂舞春秋 阅读(188) 评论(0) 推荐(0)
摘要: public void add(Customer c){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try{ conn = JdbcUtils.getConnection();//工具类jdbcUtils,连接数据库,三层架构思想体现非常重要 //此方法预防sql注入,采用prepareStatement ,注意SQL 代码的写法 String sql = "in... 阅读全文
posted @ 2013-07-06 19:07 亂舞春秋 阅读(268) 评论(0) 推荐(0)
摘要: 一共两个文件:1. birthdays.js/*加载年份*/function years(obj, Cyear) { var len = 114; // select长度,即option数量 var selObj = document.getElementById(obj); var selIndex = len - 1; var newOpt; // OPTION对象 // 循环添加OPION元素到年份select对象中 for (i = 1; i 出生年份: 就这样吧,很简单,复制,粘贴,保存对文件名就能用了... 阅读全文
posted @ 2013-07-06 12:17 亂舞春秋 阅读(4371) 评论(0) 推荐(0)
摘要: 程序说明【select】先说清空一个select,最简单的方法是把options的length设为0就可以了:oSelect.options.length = 0;给select添加option,有多个方法,如果用dom的标准方法是:js代码:var op = document.createElement("option"); op.value = i; op.innerHTML = i; oSelect.appendChild(op); 对于option有更方便的方法:Js代码: oSelect.options.length = iLength; for (var i = 阅读全文
posted @ 2013-07-04 23:33 亂舞春秋 阅读(1945) 评论(0) 推荐(0)
摘要: import java.util.Map;//显示所有操作系统 环境变量 public class EnvironmentVariables { public static void main(String[] args) { for(Map.Entry entry : System.getenv().entrySet()){//System.getenv()返回一个map类型 System.out.println(entry.getKey()+" : "+entry.getValue()); } }} 阅读全文
posted @ 2013-06-28 21:36 亂舞春秋 阅读(191) 评论(0) 推荐(0)