• 大小: 6.34MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-12
  • 语言: Java
  • 标签: j2ee  java  jsp  servlet  

资源简介

[开发专家之数据库].JSP数据库开发实例精粹

资源截图

代码片段和文件信息

package com.publish.shop.bulletin.dao;

import java.sql.*;
import java.util.ArrayList;
import com.publish.shop.util.dao.SerialNoDAO;
import com.publish.shop.util.db.DbManager;
import com.publish.shop.util.db.DbPool;
import com.publish.shop.util.javabeans.Pager;
import com.publish.shop.util.javabeans.Debug;
import com.publish.shop.util.javabeans.DateTimeUtility;
import com.publish.shop.util.javabeans.DateUtility;
import com.publish.shop.bulletin.javabeans.BulletinModel;
import org.apache.struts.util.LabelValueBean;
import com.publish.shop.security.javabeans.UserModel;
import com.publish.shop.security.javabeans.UserProxy;

public class BulletinDAO {
  public BulletinDAO() {
  }

  public String insert(BulletinModel model) throws Exception{
    String sql = “insert into BulletinInfo_table(bulletintitlebulletinBodyinputUserId)“
                 +“ values(???)“;
    Connection con = null;
    PreparedStatement stmt = null;
    String bulletinId = “0“;
    try{
      con = DbPool.getConnection();
      stmt = con.prepareStatement(sql);
      stmt.setString(1model.getBulletintitle());
      stmt.setString(2model.getBulletinBody());
      stmt.setString(3model.getInputUserId());
      stmt.executeUpdate();
      con.commit();
    }catch(Exception e){
      con.rollback();
      throw e;
    }
    finally{
      DbPool.closeStatement(stmt);
      DbPool.closeConnection(con);
    }
    return bulletinId;
  }

    public void update(BulletinModel model) throws Exception{
      String sql = “update BulletinInfo_table set bulletintitle=‘“+model.getBulletintitle()+“‘bulletinBody=‘“+model.getBulletinBody()+“‘updateDate=‘“+DateTimeUtility.getCurTimeStamp()+“‘isValid=‘“+model.getIsValid()
          +“ where bulletinId=‘“+model.getBulletinId()+“‘“;
      Connection con = null;
      Statement stmt = null;
      try{
        con = DbPool.getConnection();
        stmt = con.createStatement();
        stmt.executeUpdate(sql);
        con.commit();
      }catch(Exception e){
        throw e;
      }
      finally{
        DbPool.closeStatement(stmt);
        DbPool.closeConnection(con);
      }
    }

    public void delete(String bulletinId) throws Exception{
        String sql = “delete from BulletinInfo_table where bulletinId=‘“ + bulletinId +“‘“;
        Connection con = null;
        PreparedStatement stmt = null;
        try
        {
          con = DbPool.getConnection();
          stmt = con.prepareStatement(sql);
          stmt.executeUpdate();
          con.commit();
        }
        catch(Exception e)
        {
          throw e;
        }
        finally
        {
          DbPool.closeStatement(stmt);
          DbPool.closeConnection(con);
        }
    }

    public ArrayList query(BulletinModel model) throws Exception{
        ArrayList list = new ArrayList();
        String sql = “select bulletinIdbulletintitlebulletinBodyinputDateupdateDateinputUserIdbulletinPointbulletinSort from BulletinInfo_table where isValid=‘Y‘“;
        if(mo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        617  2002-09-26 20:23  SHOP\CodeResource\css\CSS.CSS

     文件      21984  2004-09-07 16:40  SHOP\CodeResource\css\font.css

     文件       2464  2003-08-24 10:55  SHOP\CodeResource\css\msg.css

     文件       2218  2003-03-26 15:47  SHOP\CodeResource\css\pub.css

     目录          0  2006-05-30 13:42  SHOP\CodeResource\css

     文件       3367  2004-09-24 02:22  SHOP\CodeResource\docroot\admin\BulletinAdd.jsp

     文件       4618  2004-09-24 02:10  SHOP\CodeResource\docroot\admin\BulletinModify.jsp

     文件       4100  2004-09-24 00:58  SHOP\CodeResource\docroot\admin\BulletinSearch.jsp

     文件       4913  2004-09-17 23:25  SHOP\CodeResource\docroot\admin\CategorySearch.jsp

     文件       5844  2004-09-23 00:32  SHOP\CodeResource\docroot\admin\OrderModify.jsp

     文件       7121  2004-09-23 00:36  SHOP\CodeResource\docroot\admin\OrderSearch.jsp

     文件       5694  2004-09-17 23:25  SHOP\CodeResource\docroot\admin\StoreAdd.jsp

     文件       6248  2004-09-17 23:25  SHOP\CodeResource\docroot\admin\StoreModify.jsp

     文件       6574  2004-09-19 15:46  SHOP\CodeResource\docroot\admin\StoreSearch.jsp

     文件       5891  2004-09-17 23:25  SHOP\CodeResource\docroot\admin\StoreView.jsp

     文件       5503  2004-10-24 14:20  SHOP\CodeResource\docroot\admin\UserAdd.jsp

     文件       5772  2004-10-24 15:02  SHOP\CodeResource\docroot\admin\UserModify.jsp

     文件       7774  2004-09-17 23:26  SHOP\CodeResource\docroot\admin\UserSearch.jsp

     目录          0  2006-05-30 13:42  SHOP\CodeResource\docroot\admin

     文件       7289  2004-10-24 15:05  SHOP\CodeResource\docroot\default.jsp

     文件       5494  2004-10-24 15:13  SHOP\CodeResource\docroot\purchase\DGService.jsp

     文件       4464  2004-10-24 15:12  SHOP\CodeResource\docroot\purchase\DGServices.jsp

     文件       5142  2004-09-20 15:36  SHOP\CodeResource\docroot\purchase\OrderView.jsp

     文件       5297  2004-09-17 23:24  SHOP\CodeResource\docroot\purchase\ProductSearch.jsp

     文件       5893  2004-09-17 23:24  SHOP\CodeResource\docroot\purchase\ProductView.jsp

     目录          0  2006-05-30 13:42  SHOP\CodeResource\docroot\purchase

     文件       8949  2004-09-17 22:56  SHOP\CodeResource\docroot\side.jsp

     目录          0  2006-05-30 13:42  SHOP\CodeResource\docroot

     文件      24245  2002-09-26 23:55  SHOP\CodeResource\images\01.gif

     文件        246  2002-09-13 11:24  SHOP\CodeResource\images\1.gif

............此处省略520个文件信息

评论

共有 条评论