001-基于javaEE的停车场管理系统

本系统采用JAVAEE开发形式,利用数据库来完成数据存储功能,运用了B/S形式的开发模式,严格按照了软件工程的开发模式进行开发,保证系统的良好运行。
关键词:停车场系统;Javaee;Tomcat
package com.servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.DB;

/**

  • Servlet implementation class Cw_deleteServlet
    */
    public class Cw_deleteServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // 获取id
    int id = Integer.valueOf(request.getParameter(“id”));
    try {
    DB hy = new DB();
    Connection str = hy.getCon();
    // 删除信息的SQL语句
    String sqltt = “delete from chewei where id=?”;
    // 获取PreparedStatement
    PreparedStatement pstt = str.prepareStatement(sqltt);
    // 对SQL语句中的第一个占位符赋值
    pstt.setInt(1, id);
    // 执行更新操作
    pstt.executeUpdate();
    // 关闭PreparedStatement
    pstt.close();
    // 关闭Connection
    str.close();
    } catch (Exception e) {
    e.printStackTrace();
    }
    // 重定向到TeachServlet
    response.sendRedirect("./admin/chewei_mg.jsp");
    }
    }


package com.servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.DB;

/**

  • Servlet implementation class Hf_Servlet
    */
    public class Hf_Servlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // 获取id

     String id=new String(request.getParameter("id").getBytes("ISO-8859-1"),"GB18030");
     
     
     try {
     	DB vvv = new DB();
     	Connection sty = vvv.getCon();
     	// 删除信息的SQL语句
     	String sqlmm = "update weigui set states='' where id=?";
     	// 获取PreparedStatement
     	PreparedStatement pscc = sty.prepareStatement(sqlmm);
     	// 对SQL语句中的第一个占位符赋值
     	
     	pscc.setString(1, id);
    
     	
     	// 执行更新操作
     	pscc.executeUpdate();
     	// 关闭PreparedStatement
     	pscc.close();
     	// 关闭Connection
     	sty.close();
     } catch (Exception e) {
     	e.printStackTrace();
     } 
     // 重定向到TeachServlet
     //out.println("<script>alert('更改成功!');window.location.href='info_up.jsp';</script>");
     response.sendRedirect("./admin/weigui_huifu.jsp");
    

    }
    }


package com.servlet;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.DB;

/**

  • Servlet implementation class Wg_delServlet
    */
    public class Wg_delServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // 获取id
    int id = Integer.valueOf(request.getParameter(“id”));
    try {
    DB hy = new DB();
    Connection str = hy.getCon();
    // 删除信息的SQL语句
    String sqltt = “delete from weigui where id=?”;
    // 获取PreparedStatement
    PreparedStatement pstt = str.prepareStatement(sqltt);
    // 对SQL语句中的第一个占位符赋值
    pstt.setInt(1, id);
    // 执行更新操作
    pstt.executeUpdate();
    // 关闭PreparedStatement
    pstt.close();
    // 关闭Connection
    str.close();
    } catch (Exception e) {
    e.printStackTrace();
    }
    // 重定向到TeachServlet
    response.sendRedirect("./admin/weigui_mg.jsp");
    }
    }
    下面是数据库
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N’[dbo].[chewei]’) AND type in (N’U’))
    BEGIN
    CREATE TABLE [dbo].[chewei](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [chewei_no] nvarchar NULL,
    [chewei_type] nvarchar NULL,
    [chewei_state] nvarchar NULL,
    [chewei_didian] nvarchar NULL,
    CONSTRAINT [PK_chewei] PRIMARY KEY CLUSTERED
    (
    [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    END
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N’[dbo].[reg]’) AND type in (N’U’))
    BEGIN
    CREATE TABLE [dbo].[reg](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [username] nvarchar NULL,
    [password] nvarchar NULL,
    [chepaihao] nvarchar NULL,
    [jine] nvarchar NULL,
    [truename] nvarchar NULL,
    [tel] nvarchar NULL,
    [jianjie] nvarchar NULL,
    [quanxian] nvarchar NULL CONSTRAINT [DF_reg_quanxian] DEFAULT (N’会员’),
    [shijian] [datetime] NULL,
    CONSTRAINT [PK_reg] PRIMARY KEY CLUSTERED
    (
    [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    END
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N’[dbo].[weigui]’) AND type in (N’U’))
    BEGIN
    CREATE TABLE [dbo].[weigui](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [username] nvarchar NULL,
    [chepaihao] nvarchar NULL,
    [states] nvarchar NULL,
    [shuoming] nvarchar NULL,
    CONSTRAINT [PK_weigui] PRIMARY KEY CLUSTERED
    (
    [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    END
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N’[dbo].[feiyong]’) AND type in (N’U’))
    BEGIN
    CREATE TABLE [dbo].[feiyong](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [username] nvarchar NULL,
    [yonghu_type] nvarchar NULL,
    [zhifu_type] nvarchar NULL,
    [jine] nvarchar NULL,
    [beizhu] nvarchar NULL,
    [shijian] [datetime] NULL,
    CONSTRAINT [PK_feiyong] PRIMARY KEY CLUSTERED
    (
    [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    END
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N’[dbo].[login]’) AND type in (N’U’))
    BEGIN
    CREATE TABLE [dbo].[login](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [username] nvarchar NULL,
    [password] nvarchar NULL,
    CONSTRAINT [PK_login] PRIMARY KEY CLUSTERED
    (
    [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    END
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N’[dbo].[gg]’) AND type in (N’U’))
    BEGIN
    CREATE TABLE [dbo].[gg](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [Gg_titile] nvarchar NULL,
    [Gg_neirong] nvarchar NULL,
    [shijian] [datetime] NULL,
    CONSTRAINT [PK_gg] PRIMARY KEY CLUSTERED
    (
    [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    END
    运行截图
    登陆界面
    记录
    添加车位
    添加违规车辆

  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值