毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 课程设计 >> 正文

java+MySql制作B/S电子商务网站 第4页

更新时间:2008-4-4:  来源:毕业论文

java+MySql制作B/S电子商务网站 第4页

package com.aheadedu.zyy;

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

import java.sql.*;

public class ggaddServlet extends HttpServlet {

    private static final String CONTENT_TYPE = "text/html; charset=GBK";

    Connection conn = null;

    //Initialize global variables

    public void init() throws ServletException {

        com.aheadedu.zyy.DbTool dbtool = new com.aheadedu.zyy.DbTool();

        conn = dbtool.getConn("aheadtb");

        System.out.println("ggaddServlet conn连接创建结束");

}

//Process the HTTP Get request

    public void service(HttpServletRequest request,

                        HttpServletResponse response) throws

            ServletException, IOException {

        boolean flag =false;

//boolean ggdel  =false;

       // String ggid=StringTool.gb2iso(request.getParameter("id"));

        String biaoti = StringTool.gb2iso(request.getParameter("biaoti"));

        String neirong =StringTool.gb2iso( request.getParameter("neirong"));

        String chuangjian = StringTool.gb2iso(request.getParameter("chuangjian"));

        Gonggao  gg = new Gonggao();

       flag =  gg.add(biaoti,neirong,chuangjian);

      // ggdel =gg.del(ggid);

 

   if(flag){

        RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/admin/gg_manage.jsp");

        rd.forward(request, response);

   }else

   {

       RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/admin/ggadderror.jsp");

       rd.forward(request, response);

}

}

//Clean up resources

    public void destroy() {

        try {

            conn.close();

            System.out.println("关闭连接");

        } catch (SQLException ex) {

        }}}

6.2删除公告信息

  删除公告也是通过编写ggdelservlet

package com.aheadedu.zyy;

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

import java.sql.*;

public class ggdelServlet extends HttpServlet {

    private static final String CONTENT_TYPE = "text/html; charset=GBK";

    Connection conn = null;

    //Initialize global variables

    public void init() throws ServletException {

        com.aheadedu.zyy.DbTool dbtool = new com.aheadedu.zyy.DbTool();

        conn = dbtool.getConn("aheadtb");

        System.out.println("ggdelServlet conn连接创建结束");

}

//Process the HTTP Get request

    public void service(HttpServletRequest request,

                        HttpServletResponse response) throws

            ServletException, IOException {

 

        boolean ggdel  =false;

        String ggid=StringTool.gb2iso(request.getParameter("id"));

        Gonggao  gg = new Gonggao();

 

       ggdel =gg.del(ggid);

   if(ggdel){

        RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/admin/gg_manage.jsp");

        rd.forward(request, response);

   }else

   {

       RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/admin/ggadderror.jsp");

       rd.forward(request, response);

 

   }

 }

 

    //Clean up resources

    public void destroy() {

        try {

            conn.close();

            System.out.println("关闭连接");

        } catch (SQLException ex) {

        }

}

}

上一页  [1] [2] [3] [4] [5] 下一页

java+MySql制作B/S电子商务网站 第4页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。