精华内容
下载资源
问答
  • 课程设计题目:库存物资管理 背景资料: 有一个存放商品的仓库,每天都有商品出库和入库。 每种商品都有名称、生产厂家、型号、规格等。 出入库时必须填写出入库单据,单据包括商品名称、生产厂家、型号、规格、数量...
  • 课程设计题目:库存物资管理 背景资料: 有一个存放商品的仓库,每天都有商品出库和入库。 每种商品都有名称、生产厂家、型号、规格等。 出入库时必须填写出入库单据,单据包括商品名称、生产厂家、型号、规格、...
  • (库存管理)数据库课程设 计库存物资管理系统后台 数据库 目录 库存物资管理系统后台数据库 1 第 1 章进行需求分析编写数据字典 1 1.1 系统功能要求设计1 1.2 模块设计 1 1.3 数据字典 2 第 2 章面向对象分析和设计 4...
  • 库存物资管理系统

    2012-12-26 10:19:49
    用MFC实现库存物资管理系统,在SQL SERVER 2005和VC++中实现
  • 物资库存管理系统

    2018-04-25 14:59:04
    对仓库物资的相关信息进行记录,用户可以根据物资的名称或代码进行搜索。
  • 本文主要分析了库存管理系统的一些基本功能和组成情况,包括系统的需求分析、系统结构、功能模块划分以及数据库模式分析等,重点对应用程序的实际开发实现作了介绍,同时简单介绍了Visual Basic编程环境和Access...
  • 库存物资管理系统数据库设计.pdf
  • 库存物资管理系统的实现报告.doc
  •  (4)系统数据维护:分为物资供应商信息(编号、名称、主管、简介等)管理和产品信息管理。  (5)账务管理管理后勤公司的结账业务,每个月都要进行一次结账操作,确定该财务月份所有物资的进、销、结存情况,...
  • 公司库存物资管理系统课程设计报告.doc
  • ShopWarehouse 数据库配置文件在src/model/ConnDB.java 效果图 登录页面 欢迎页 订单管理 商品管理 个人中心
  • 库存物资管理系统实验要求如下: 1.背景资料 1、有一个存放商品的仓库,每天都有商品出库和入库。2、每种商品都有名称、生产厂家、型号、规格等。3、出入库时必须填写出入库单据,单据包括商品名称、生产厂家、...
    库存物资管理系统实验要求如下:
    1.背景资料
    1、有一个存放商品的仓库,每天都有商品出库和入库。
    2、每种商品都有名称、生产厂家、型号、规格等。
    3、出入库时必须填写出入库单据,单据包括商品名称、生产厂家、型号、
    规格、数量、日期、时间、入库单位(或出库单位)名称、送货(或提货)人
    姓名。
    2.系统要求与功能设计
    2.1页面要求
    (1)能够在Tomcat服务器中正确部署,并通过浏览器查看;(1分)
    (2)网站页面整体风格统一;
    2.2设计要求
    1、设计出入库单据的录入。
    2、实现按商品名称、出入库日期的查询。
     3.评分标准:
    1、A类:完全实现上述功能,达到A类标准的同学可以免于参加期末上机考试,
    期末上机考试成绩按满分计算。
    2、B类:实现出入库单据记录的添加。
    3、C类:实现数据库的连接。
    4、D类:不满足上述要求的。
     

    详细过程:1.刚拿到题目,觉得貌似比上次的简单,因为看题目要求的篇幅并不多,但看完题后,思考编写的过程发现并不简单,题目能给的关键信息点太少;

    2.首先编写必要的jsp界面,自己懒得写,是课前在网上见过的类似界面代码修改而成的,想省下点时间写关键的方法代码;

    3.商品信息的录入和查询通过上次实验的学习已经基本掌握了,但是也费了半天时间弄,主要是不太熟悉,有些东西也是修改代码完成的;

    4.接下来就是最头疼的那个出库,有点懵,我一开始想是不是还用考虑往外取物资的系统,瞎编了半天没结果,马上就快下机了,然后听说是没那么复杂,就是相当于上次学生管理系统的修改步骤,想着A标已经无妄了,就回宿舍参考了上次的那个系统又改了快一个多小时,终于磕磕巴巴的做出了个粗糙的程序。

     

    总结:上次靠学长的代码完完全全的实现了功能,觉得下一次做系统应该差不多了,没想到只是按照人家的思路可以做下来,自己做一个新的系统,一些类似的死的东西道是没问题,出了个出库就直接懵了,还是缺乏自己的独立思考,不过这次就是同学提醒了一下思路就自己完成了,还算有进步了,时间花费比较多,以后要加快速度。

     

     

     

     

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <style>
        .a{
            margin-top: 20px;
        }
        .b{
            font-size: 20px;
            width: 160px;
            color: white;
            background-color: greenyellow;
        }
    </style>
    </head>
    <body>
        <%
             Object message = request.getAttribute("message");
             if(message!=null && !"".equals(message)){
         
        %>
             <script type="text/javascript">
                  alert("<%=request.getAttribute("message")%>");
             </script>
        <%} %>
        <div align="center">
            <h1 style="color: red;">商品入库</h1>
            <a href="index.jsp">返回主页</a>
            <form action="UserServlet?method=add" method="post" οnsubmit="return check()">
                <div class="a">
                    分类名<input type="text" name="name" />
                </div>
                <div class="a">    
                                    厂家<input type="text" name="changjia" />
                </div>
                <div class="a">
                    型号<input type="text" name="xinghao"/>
                </div>
                <div class="a">
                    规格<input type="text" name="guige"/>
                </div>
                <div class="a">
                    数量<input type="text" name="shuliang" />
                </div>
                <div class="a">
                    日期<input type="text" name="riqi" />
                </div>
                <div class="a">
                    单位名称<input type="text" name="danwei" />
                </div>
                <div class="a">
                    人名<input type="text" name="xingming"/>
                </div>
                <div class="a">
                    操作<input type="text" name="caozuo"/>
                </div>
                <div class="a">
                    <input type="submit" value="添加" onClick="delcfm1()" />
                </div>
            </form>
        </div>
         <script language="javascript"> 
        function delcfm1() { 
            if (!confirm("确认要添加?")) { 
                window.event.returnValue = false; 
            } 
        } 
       </script>
    </body>
    </html>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <style>
        .a{
            margin-top: 20px;
        }
        .b{
            font-size: 20px;
            width: 160px;
            color: white;
            background-color: greenyellow;
        }
    </style>
    </head>
    <body>
        <%
             Object message = request.getAttribute("message");
             if(message!=null && !"".equals(message)){
         
        %>
             <script type="text/javascript">
                  alert("<%=request.getAttribute("message")%>");
             </script>
        <%} %>
        <div align="center">
            <h1 style="color: red;">删除</h1>
            <a href="index.jsp">返回主页</a>
            <form action="UserServlet?method=getuserbyname" method="post" οnsubmit="return check()">
                <div class="a">
                    商品名称<input type="text" name="name" />
                </div>
                <div class="a">
                    <button type="submit" class="b">查&nbsp;&nbsp;&nbsp;找</button>
                </div>
            </form>
        </div>
        <script type="text/javascript">
            function check() {
                var name = document.getElementByName("name");;
                
                //非空
                if(name.value == '') {
                    alert('商品名称为空');
                    name.focus();
                    return false;
                }
            }
        </script>
    </body>
    </html>

     

     

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <style>
        .a{
            margin-top: 20px;
        }
        .b{
            font-size: 20px;
            width: 160px;
            color: white;
            background-color: greenyellow;
        }
        .tb, td {
            border: 1px solid black;
            font-size: 22px;
        }
    </style>
    </head>
    <body>
        <div align="center">
            <h1 style="color: red;"></h1>
            <a href="index.jsp">返回主页</a>
            <table class="tb">
                <tr>
                    <td>商品名称</td>
                    <td>${user.name}</td>
                </tr>
                <tr>
                    <td>商品厂家</td>
                    <td>${user.changjia}</td>
                </tr>
                <tr>
                    <td>商品型号</td>
                    <td>${user.xinghao}</td>
                </tr>
                            <tr>
                    <td>商品规格</td>
                    <td>${user.guige}</td>
                </tr>            
                            <tr>
                    <td>商品数量</td>
                    <td>${user.shuliang}</td>
                </tr>            
                            <tr>
                    <td>日期</td>
                    <td>${user.riqi}</td>
                </tr>            
                            <tr>
                    <td>单位</td>
                    <td>${user.danwei}</td>
                </tr>
                            <tr>
                    <td>姓名</td>
                    <td>${user.xingming}</td>
                </tr>            
                <tr>
                    <td>操作</td>
                    <td>${user.caozuo}</td>
                </tr>        
            </table>
            <div class="a">
                <a οnclick="return check()" href="UserServlet?method=del&name=${user.name}">删&nbsp;&nbsp;&nbsp;除</a>
            </div>
        </div>
        <script type="text/javascript">
            function check() {
                if (confirm("真的要删除吗?")){
                    return true;
                }else{
                    return false;
                }
            }
        </script>
    </body>
    </html>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>首页</title>
    <style>
        .a{
            font-size: 26px;
            margin-top: 20px;
        }
    </style>
    </head>
    <body>
        <div align="center">
            <h1 style="color: red;">库存物资管理</h1>
            <div class="a">
                <a href="add.jsp">商品出入库</a>
            </div>
            <div class="a">
                <a href="del.jsp">商品的删除</a>
            </div>
            <div class="a">
                <a href="search.jsp">查询</a>
            </div>
        </div>
    </body>
    </html>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <style>
        .a{
            margin-top: 20px;
        }
        .b{
            font-size: 20px;
            width: 160px;
            color: white;
            background-color: greenyellow;
        }
        .tb, td {
            border: 1px solid black;
            font-size: 22px;
        }
    </style>
    </head>
    <body>
        <%
             Object message = request.getAttribute("message");
             if(message!=null && !"".equals(message)){
         
        %>
             <script type="text/javascript">
                  alert("<%=request.getAttribute("message")%>");
             </script>
        <%} %>
        <div align="center">
            <h1 style="color: red;">商品信息列表</h1>
            <a href="index.jsp">返回主页</a>
                <form action="UserServlet?method=getuserbyname" method="post" οnsubmit="return check()">
                <div class="a">
                    商品名称<input type="text" name="name" />
                </div>
                <div class="a">
                    <button type="submit" class="b">查&nbsp;&nbsp;&nbsp;找</button>
                </div>
            </form>
        </div>
        <script type="text/javascript">
            function check() {
                var name = document.getElementById("name");;
                
                //非空
                if(name.value == '') {
                    alert('商品名称为空');
                    name.focus();
                    return false;
                }
            }
        </script>
    </body>
    </html>
    package com.jaovo.msg.dao;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import java.util.List;
    import com.jaovo.msg.model.User;
    import com.jaovo.msg.Util.DBUtil;
    public class Dao {
    
        public boolean add(User user) {
            String sql = "insert into user( name, changjia,xinghao,guige,shuliang,riqi,danwei,xingming,caozuo) values('" + user.getName() + "','" + user.getChangjia() + "','" + user.getXinghao() + "','" + user.getGuige() + "','" + user.getShuliang() + "','" + user.getRiqi() +"','" + user.getDanwei() +"','" + user.getXingming()  +"','" + user.getCaozuo()+"')";
            Connection conn = DBUtil.getConn();
            Statement state = null;
            boolean f = false;
            int a = 0;
            try {
                state = conn.createStatement();
                state.executeUpdate(sql);
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                DBUtil.close(state, conn);
            }
            
            if (a > 0) {
                f = true;
            }
            return f;
        }
    
        public boolean delete (String name) {
            boolean f = false;
            String sql = "delete from user where name='" + name + "'";
            Connection conn = DBUtil.getConn();
            Statement state = null;
            int a = 0;
            try {
                state = conn.createStatement();
                a = state.executeUpdate(sql);
            } catch (SQLException e) {
                e.printStackTrace();
            } finally {
                DBUtil.close(state, conn);
            }
            
            if (a > 0) {
                f = true;
            }
            return f;
        }
    
        public boolean update(User user) {
            String sql = "update user set guige='"+user.getGuige()+ "', changjia='" + user.getChangjia() + "', xinghao='" + user.getXinghao()+ "', shuliang='" + user.getShuliang() +"', riqi='" + user.getRiqi() +"', danwei='" + user.getDanwei()+"', xingming='" + user.getXingming()  +"', caozuo='" + user.getCaozuo() +"'where name='" + user.getName() + "'";
            Connection conn = DBUtil.getConn();
            Statement state = null;
            boolean f = false;
            int a = 0;
    
            try {
                state = conn.createStatement();
                a = state.executeUpdate(sql);
            } catch (SQLException e) {
                e.printStackTrace();
            } finally {
                DBUtil.close(state, conn);
            }
            
            if (a > 0) {
                f = true;
            }
            return f;
        }
    
        public boolean name(String name) {
            boolean flag = false;
            String sql = "select name from user where name = '" + name + "'";
            Connection conn = DBUtil.getConn();
            Statement state = null;
            ResultSet rs = null;
            
            try {
                state = conn.createStatement();
                rs = state.executeQuery(sql);
                while (rs.next()) {
                    flag = true;
                }
            } catch (SQLException e) {
                e.printStackTrace();
            } finally {
                DBUtil.close(rs, state, conn);
            }
            return flag;
        }
        
        public User getUserByName(String name) {
            String sql = "select * from user where name ='" + name + "'";
            Connection conn = DBUtil.getConn();
            Statement state = null;
            ResultSet rs = null;
            User user= null;
            
            try {
                state = conn.createStatement();
                rs = state.executeQuery(sql);
                while (rs.next()) {
                    String name1 = rs.getString("name");
                    String changjia= rs.getString("changjia");
                    String xinghao= rs.getString("xinghao");
                    String guige =rs.getString("guige");
                    String shuliang=rs.getString("shuliang");
                    String riqi=rs.getString("riqi");
                    String danwei=rs.getString("danwei");
                     String xingming=rs.getString("xingming");
                     String caozuo=rs.getString("caozuo");
                    user = new User(name1,changjia,xinghao,guige,shuliang,riqi,danwei,xingming,caozuo);
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                DBUtil.close(rs, state, conn);
            }
            
            return user;
        }
        
        public List<User> search(String name,String changjia,String xinghao,String guige,String shuliang,String riqi,String danwei,String xingming ) {
            String sql = "select * from user where ";
            if (name != "") {
                sql += "name like '%" + name + "%'";
            }
            if (changjia!= "") {
                sql += "changjia like '%" + changjia + "%'";
            }
            if (xinghao != "") {
                sql += "xinghao like '%" + xinghao+ "%'";
            }
            if (guige != "") {
                sql += "guige like '%" + guige+ "%'";
            }
            if (shuliang != "") {
                sql += "shuliang like '%" + shuliang + "%'";
            }
            if (riqi != "") {
                sql += "riqi like '%" + riqi + "%'";
            }
            if (danwei != "") {
                sql += "danwei like '%" + danwei+ "%'";
            }
            if (xingming != "") {
                sql += "xingming like '%" + xingming + "%'";
            }
            List<User> list = new ArrayList<>();
            Connection conn = DBUtil.getConn();
            Statement state = null;
            ResultSet rs = null;
    
            try {
                state = conn.createStatement();
                rs = state.executeQuery(sql);
                User bean = null;
                while (rs.next()) {
                    String name1 = rs.getString("name");
                    String changjia1= rs.getString("changjia");
                    String xinghao1= rs.getString("xinghao");
                    String guige1 =rs.getString("guige");
                    String shuliang1=rs.getString("shuliang");
                    String riqi1=rs.getString("riqi");
                    String danwei1=rs.getString("danwei");
                     String xingming1=rs.getString("xingming");
                     String caozuo=rs.getString("caozuo");
                    bean = new User(name1,changjia1,xinghao1,guige1,shuliang1,riqi1,danwei1,xingming1,caozuo);
                    list.add(bean);
                }
            } catch (SQLException e) {
                e.printStackTrace();
            } finally {
                DBUtil.close(rs, state, conn);
            }
            
            return list;
        }
    
        public List<User> list() {
            String sql = "select * from user";
            List<User> list = new ArrayList<>();
            Connection conn = DBUtil.getConn();
            Statement state = null;
            ResultSet rs = null;
    
            try {
                state = conn.createStatement();
                rs = state.executeQuery(sql);
                User bean = null;
                while (rs.next()) {
                    String name = rs.getString("name");
                    String changjia= rs.getString("changjia");
                    String xinghao= rs.getString("xinghao");
                    String guige =rs.getString("guige");
                    String shuliang=rs.getString("shuliang");
                    String riqi=rs.getString("riqi");
                    String danwei=rs.getString("danwei");
                    String xingming=rs.getString("xingming");
                     String caozuo=rs.getString("caozuo");
                    bean= new User(name,changjia,xinghao,guige,shuliang,riqi,danwei,xingming,caozuo);
                    list.add(bean);
                }
            } catch (SQLException e) {
                e.printStackTrace();
            } finally {
                DBUtil.close(rs, state, conn);
            }
            
            return list;
        }
    
    
    }
    package com.jaovo.msg.model;
    import java.sql.Connection;
    public class User {
        private String name;
        private String changjia;
        private String xinghao;
        private String guige;
        private String shuliang;
        private String riqi;
        private String danwei;
        private String xingming;
        private String caozuo;
        public void setName(String name) {
            this.name = name;
        }
        public String getName() {
            return name;
        }
        public String getChangjia() {
            return changjia;
        }
        public void setChangjia(String changjia) {
            this.changjia = changjia;
        }
        public String getXinghao() {
            return xinghao;
        }
        public void setXinghao(String xinghao) {
            this.xinghao = xinghao;
        }
        public String getGuige() {
            return guige;
        }
        public void setGuige(String guige) {
            this.guige = guige;
        }
        public String getShuliang() {
            return shuliang;
        }
        public void setShuliang(String shuliang) {
            this.shuliang = shuliang;
        }
        public String getRiqi() {
            return riqi;
        }
        public void setRiqi(String riqi) {
            this.riqi = riqi;
        }
        public String getDanwei() {
            return danwei;
        }
        public void setDanwei(String danwei) {
            this.danwei = danwei;
        }
        public String getXingming() {
            return xingming;
        }
        public void setXingming(String xingming) {
            this.xingming = xingming;
        }
        public User(String name,String changjia,String xinghao,String guige,String shuliang,String riqi,String danwei,String xingming ,String caozuo) {
            this.name = name;
            this.changjia = changjia;
            this.xinghao = xinghao;
            this.guige = guige;
            this.shuliang = shuliang;
            this.riqi = riqi;
            this.danwei = danwei;
            this.xingming = xingming;
            this.setCaozuo(caozuo);
        }
        public User() {
            // TODO Auto-generated constructor stub
        }
        public String getCaozuo() {
            return caozuo;
        }
        public void setCaozuo(String caozuo) {
            this.caozuo = caozuo;
        }
        
    }
    package com.jaovo.msg.service;
    import java.util.List;
    import com.jaovo.msg.dao.Dao;
    import com.jaovo.msg.model.User;
    public class UserService {
        Dao cDao = new Dao();
        public boolean add(User user) {
            boolean f = false;
            if(!cDao.name(user.getName())) {
                cDao.add(user);
                f = true;
            }
            return f;
        }
        public void del(String  name) {
            cDao.delete(name);
        }
        public void update(User user) {
            cDao.update(user);
        }
        public User getUserByName(String name) {
            return cDao.getUserByName(name);
        }
    
        public List<User> search(String name ) {
            return (List<User>) cDao.getUserByName(name);
        }
        public List<User> list() {
            return cDao.list();
        }
    }
    package com.jaovo.msg.severlet;
    import java.io.IOException;
    import java.util.List;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import com.jaovo.msg.model.User;
    import com.jaovo.msg.service.UserService;
    @WebServlet("/UserServlet")
    public class UserServlet extends HttpServlet {
        
        private static final long serialVersionUID = 1L;
    
        UserService service = new UserService();
        
        /**
         * 鏂规硶閫夋嫨
         */
        protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            req.setCharacterEncoding("utf-8");
            String method = req.getParameter("method");
            if ("add".equals(method)) {
                add(req, resp);
            } else if ("del".equals(method)) {
                del(req, resp);
            } else if ("update".equals(method)) {
                update(req, resp);
            } else if ("search".equals(method)) {
                search(req, resp);
            }        else if ("getuserbyname".equals(method)) {
                getUserByName(req, resp);
            } else if ("list".equals(method)) {
                list(req, resp);
            }
        }
    
        /**
         * 娣诲姞
         * @param <service>
         * @param req
         * @param resp
         * @throws IOException 
         * @throws ServletException 
         */
        private <service> void add(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
            req.setCharacterEncoding("utf-8");
            String name = req.getParameter("name");
            String changjia= req.getParameter("changjia");
            String xinghao=req.getParameter("xinghao");
            String guige =req.getParameter("guige");
            String shuliang=req.getParameter("shuliang");
            String riqi=req.getParameter("riqi");
            String danwei=req.getParameter("danwei");
            String xingming=req.getParameter("xingming");
            String caozuo=req.getParameter("caozuo");
            User user = new User(name,changjia,xinghao,guige,shuliang,riqi,danwei,xingming,caozuo);
            
            //娣诲姞鍚庢秷鎭樉绀�
            if(service.add(user)) {
                req.setAttribute("message", "娣诲姞鎴愬姛");
                req.getRequestDispatcher("add.jsp").forward(req,resp);
            } else {
                req.setAttribute("message", "鍟嗗搧鍚嶇О閲嶅锛岃閲嶆柊褰曞叆");
                req.getRequestDispatcher("add.jsp").forward(req,resp);
            }
        }
        
        /**
         * 鍏ㄩ儴
         * @param req
         * @param resp
         * @throws ServletException 
         */
        private void list(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
            req.setCharacterEncoding("utf-8");
            List<User> users = service.list();
            req.setAttribute("users", users);
            req.getRequestDispatcher("list.jsp").forward(req,resp);
        }
    
        /**
         * 閫氳繃鍚嶅瓧鏌ユ壘
         * 璺宠浆鑷冲垹闄�
         * @param req
         * @param resp
         * @throws IOException
         * @throws ServletException 
         */
        private void getUserByName(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
            req.setCharacterEncoding("utf-8");
            String name = req.getParameter("name");
            User user = service.getUserByName(name);
            if(user == null) {
                req.setAttribute("message", "鏌ユ棤姝ゅ晢鍝侊紒");
                req.getRequestDispatcher("del.jsp").forward(req,resp);
            } else {
                req.setAttribute("user", user);
                req.getRequestDispatcher("detail.jsp").forward(req,resp);
            }
        }
        /**
         * 鍒犻櫎
         * @param req
         * @param resp
         * @throws IOException
         * @throws ServletException 
         */
        private void del(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
            req.setCharacterEncoding("utf-8");
            String name = req.getParameter("name");
            service.del(name);
            req.setAttribute("message", "鍒犻櫎鎴愬姛锛�");
            req.getRequestDispatcher("del.jsp").forward(req,resp);
        }
        
        /**
         * 淇敼
         * @param req
         * @param resp
         * @throws IOException
         * @throws ServletException 
         */
        private void update(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
            req.setCharacterEncoding("utf-8");
            String name = req.getParameter("name");
            String changjia= req.getParameter("changjia");
            String xinghao=req.getParameter("xinghao");
            String guige =req.getParameter("guige");
            String shuliang=req.getParameter("shuliang");
            String riqi=req.getParameter("riqi");
            String danwei=req.getParameter("danwei");
            String xingming=req.getParameter("xingming");
            String caozuo=req.getParameter("caozuo");
            User user = new User(name,changjia,xinghao,guige,shuliang,riqi,danwei,xingming,caozuo);
            service.update(user);
            req.setAttribute("message", "淇敼鎴愬姛");
            req.getRequestDispatcher("").forward(req,resp);
        }
        
        /**
         * 鏌ユ壘
         * @param req
         * @param resp
         * @throws ServletException 
         */
        private void search(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
            req.setCharacterEncoding("utf-8");
            String name = req.getParameter("name");
            String changjia= req.getParameter("changjia");
            String xinghao= req.getParameter("xinghao");
            String guige =req.getParameter("guige");
            String shuliang=req.getParameter("shuliang");
            String riqi=req.getParameter("riqi");
            String danwei=req.getParameter("danwei");
            String xingming=req.getParameter("xingming");
            List<User> users = service.search(name);
            req.setAttribute("users", users);
            req.getRequestDispatcher("searchlist.jsp").forward(req,resp);
        }
    }
    package com.jaovo.msg.Util;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    
    /**
     * 鏁版嵁搴撹繛鎺ュ伐鍏�
     * @author Hu
     *
     */
    public class DBUtil {
        
        public static String db_url = "jdbc:mysql://localhost:3306/runoob?useUnicode=true&characterEncoding=utf-8";
        public static String db_user = "root";
        public static String db_pass = "root";
        
        public static Connection getConn () {
            Connection conn = null;
            
            try {
                Class.forName("com.mysql.cj.jdbc.Driver");//鍔犺浇椹卞姩
                conn = DriverManager.getConnection(db_url, db_user, db_pass);
            } catch (Exception e) {
                e.printStackTrace();
            }
            
            return conn;
        }
        
        /**
         * 鍏抽棴杩炴帴
         * @param state
         * @param conn
         */
        public static void close (Statement state, Connection conn) {
            if (state != null) {
                try {
                    state.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
        
        public static void close (ResultSet rs, Statement state, Connection conn) {
            if (rs != null) {
                try {
                    rs.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            
            if (state != null) {
                try {
                    state.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    
    }

     

    转载于:https://www.cnblogs.com/cuijunfeng/p/10117179.html

    展开全文
  • 数据库课程设计---库存物资管理系统后台数据库.doc
  • 电子政务-基于射频识别技术的电力部门库存物资管理系统.zip
  • 题目: 1、有一个存放商品的仓库,每天都有商品出库和入库。 2、每种商品都有名称、生产厂家、型号、规格等。 3、出入库时必须填写出入库单据,单据包括商品名称、生产厂家、型号、 规格、数量、日期、时间、入库...

    题目:

    1、有一个存放商品的仓库,每天都有商品出库和入库。

    2、每种商品都有名称、生产厂家、型号、规格等。

    3、出入库时必须填写出入库单据,单据包括商品名称、生产厂家、型号、 规格、数量、日期、时间、入库单位(或出库单位)名称、送货(或提货)人 姓名。

    首先建立数据库goodsmanager

    table:goods记录商品信息

    table:list记录出入库信息

    Java部分:

    先把页面写好

    首页面用<iframe>分为左侧导航栏,和右侧页面

    点击左侧超链接即可实现右侧页面的跳转,在left.jsp中使用<a>的target属性来控制

    1 <div>
    2 <div><a style="color:blue" target="right" href="select.jsp">查询</a></div><br/>
    3 <div><a style="color:blue" target="right" href="out.jsp">出库</a></div><br/>
    4 <div><a style="color:blue" target="right" href="in.jsp">入库</a></div><br/>
    5 <div><a style="color:blue" target="right" href="1.jsp">增加商品</a></div><br/>
    6 <div><a style="color:blue" target="right" href="2.jsp">删除商品</a></div><br/>
    7 <div><a style="color:blue" target="right" href="3.jsp">修改商品</a></div><br/>
    8 <div><a style="color:blue" target="right" href="4.jsp">查询商品</a></div><br/>
    9 </div>
    left.jsp

    验证跳转没有问题后,先写出库和入库。

    新建数据库连接工具DB.java,放到com.ccr.jap.util包下

    新建GoodsBean和ListBean,包括对应的私有变量和get、set函数

    新建GoodsDao、ListDao进行数据库的增删改查操作

    入库涉及到两种情况:

    1、商品已存在

    2、商品未存在

    首先调用GoodsDao里的chick()函数,如果商品存在,返回id,否则返回-1;

     1 public int chick(GoodsBean g)
     2     {
     3         int i=-1;//i>0查询有结果
     4         DB db=new DB();
     5         Connection con = db.getCon();
     6         try
     7         {
     8         Statement stm = con.createStatement();
     9         ResultSet rs =stm.executeQuery("select id from goods where name='"+g.getName()+"' and PM='"+g.getPM()+"' and type='"+g.getType()+"' and specification='"+g.getSpecification()+"'");
    10         if(rs.next())
    11         {
    12             i=rs.getInt("id");
    13         }
    14         } 
    15         catch (Exception e) 
    16         {
    17         e.printStackTrace();
    18         }
    19         return i;
    20     }
    GoodsDao.chick()

    如果存在,直接修改商品数量

     1 public boolean update(int number,int i)
     2     {
     3         int num=0;
     4         DB db=new DB();
     5         Connection con = db.getCon();
     6         try
     7         {
     8         Statement stm = con.createStatement();
     9         ResultSet rs =stm.executeQuery("select number from goods where id="+i);
    10         System.out.println("update"+i+"num "+number);
    11         rs.next();
    12         num=rs.getInt("number");
    13         System.out.print(num+"+"+number);
    14         num=num+number;
    15         System.out.println("="+num);
    16         stm.execute("update goods set number="+num+" where id="+i);
    17         }
    18         catch (Exception e) 
    19         {
    20         e.printStackTrace();
    21         return false;
    22         }
    23         return true;
    24     }
    GoodsDao.update(int number,int i)

    不存在,则新建商品信息

     1 public boolean insert(GoodsBean g)
     2     {
     3         DB db=new DB();
     4         Connection con = db.getCon();
     5         try
     6         {
     7         Statement stm = con.createStatement();
     8         stm.execute("insert into goods(name,PM,type,specification,number) values ('"+g.getName()+"','"+g.getPM()+"','"+g.getType()+"','"+g.getSpecification()+"',"+g.getNumber()+")");
     9         }
    10         catch (Exception e) 
    11         {
    12         e.printStackTrace();
    13         return false;
    14         }
    15         return true;
    16     }
    GoodsDao.insert(GoodsBean g)

    然后调用ListDao里的insert()函数新建入库信息

     1 public boolean insert(ListBean l)
     2     {
     3         DB db=new DB();
     4         Connection con = db.getCon();
     5         try
     6         {
     7         Statement stm = con.createStatement();
     8         stm.execute("insert into list(name,PM,type,specification,number,units,PName,io,date) "
     9                 + "values ('"+l.getName()+"','"+l.getPM()+"','"+l.getType()+"','"+l.getSpecification()+"',"+l.getNumber()+",'"+l.getUnits()+"','"+l.getPName()+"','"+l.getIo()+"','"+l.getDate()+"')");
    10         }
    11         catch (Exception e) 
    12         {
    13         e.printStackTrace();
    14         return false;
    15         }
    16         return true;
    17     }
    ListDao.insert(ListBean l)

    出库同理,但是在number赋值前先乘以-1变成负数

    然后是servlet和jsp部分

    入库:

     1 <h1>入库</h1>
     2 <form method="post" action="GoodsServlet?action=in">
     3 <div>
     4     <div>
     5         <div style="display:inline"><label for="name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label></div>
     6         <div style="display:inline"><input type="text" name="name" id="name"></div>
     7     </div><br/>
     8     <div>
     9         <div style="display:inline"><label for="name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label></div>
    10         <div style="display:inline"><input type="text" name="type" id="type"></div>
    11     </div><br/>
    12     <div>
    13         <div style="display:inline"><label for="name">出产厂家</label></div>
    14         <div style="display:inline"><input type="text" name="PM" id="PM"></div>
    15     </div><br/>
    16     <div>
    17         <div style="display:inline"><label for="name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label></div>
    18         <div style="display:inline"><input type="text" name="specification" id="specification"></div>
    19     </div><br/>
    20     <div>
    21         <div style="display:inline"><label for="name">入库单位</label></div>
    22         <div style="display:inline"><input type="text" name="units" id="units"></div>
    23     </div><br/>
    24     <div>
    25         <div style="display:inline"><label for="name">送货人名</label></div>
    26         <div style="display:inline"><input type="text" name="PName" id="PName"></div>
    27     </div><br/>
    28     <div>
    29         <div style="display:inline"><label for="name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label></div>
    30         <div style="display:inline"><input type="text" name="number" id="number"></div>
    31     </div><br/>
    32     <div>
    33         <div><input type="submit" value="提交"></div>
    34     </div>
    35 </div>
    36 </form>
    in.jsp

    提交form表单到GoodsServlet,并附加信息action=in,出库同理

     1 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
     2     {
     3         request.setCharacterEncoding("UTF-8");
     4         response.setCharacterEncoding("UTF-8");
     5         response.setContentType("text/html;charset=UTF-8");
     6         response.setHeader("content-type", "text/html;charset=UTF-8");
     7         String action=request.getParameter("action");
     8         if(action.equals("select"))
     9         {
    10             select(request,response);
    11         }
    12         if(action.equals("in"))
    13         {
    14             in(request,response);
    15         }
    16         if(action.equals("out"))
    17         {
    18             out(request,response);
    19         }
    20     }
    21 protected void in(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    22     {
    23         int id=-2;
    24         ListBean b=new ListBean();
    25         GoodsBean g=new GoodsBean();
    26         GoodsDao gd=new GoodsDao();
    27         ListDao ld=new ListDao();
    28         b.setName(request.getParameter("name"));
    29         b.setPM(request.getParameter("PM"));
    30         b.setType(request.getParameter("type"));
    31         b.setSpecification(request.getParameter("specification"));
    32         b.setNumber(Integer.parseInt(request.getParameter("number")));
    33         b.setUnits(request.getParameter("units"));
    34         b.setPName(request.getParameter("PName"));
    35         b.setIo("in");
    36         b.setDate();
    37         ld.insert(b);
    38         
    39         
    40         g.setName(request.getParameter("name"));
    41         g.setPM(request.getParameter("PM"));
    42         g.setType(request.getParameter("type"));
    43         g.setSpecification(request.getParameter("specification"));
    44         g.setNumber(Integer.parseInt(request.getParameter("number")));
    45         id=gd.chick(g);
    46         System.out.println(id);
    47         if(id>0)
    48         {
    49             gd.update(b.getNumber(), id);
    50         }
    51         else
    52         {
    53             gd.insert(g);
    54         }
    55         request.getRequestDispatcher("in.jsp").forward(request,response);
    56     }
    57     protected void out(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    58     {
    59         int id=-2;
    60         ListBean b=new ListBean();
    61         GoodsBean g=new GoodsBean();
    62         GoodsDao gd=new GoodsDao();
    63         ListDao ld=new ListDao();
    64         b.setName(request.getParameter("name"));
    65         b.setPM(request.getParameter("PM"));
    66         b.setType(request.getParameter("type"));
    67         System.out.println(b.getType());
    68         b.setSpecification(request.getParameter("specification"));
    69         int number=Integer.parseInt(request.getParameter("number"));
    70         number=-1*number;
    71         System.out.println("SN"+number);
    72         b.setNumber(number);
    73         b.setUnits(request.getParameter("units"));
    74         b.setPName(request.getParameter("PName"));
    75         b.setIo("out");
    76         b.setDate();
    77         ld.insert(b);
    78         
    79         
    80         g.setName(request.getParameter("name"));
    81         g.setPM(request.getParameter("PM"));
    82         g.setType(request.getParameter("type"));
    83         g.setSpecification(request.getParameter("specification"));
    84         g.setNumber(number);
    85         id=gd.chick(g);
    86         if(id>0)
    87         {
    88             gd.update(b.getNumber(), id);
    89         }
    90         else
    91         {
    92             System.out.println("错误");
    93         }
    94         request.getRequestDispatcher("out.jsp").forward(request,response);
    95     }
    View Code

    查询:在页面中,输入日期和时间,点击查询按钮,出现查询结构

    调用ListDao的Select,使用名称和日期进行查询,将结果存在List中

    jsp代码

     1 <h1>信息查询</h1>
     2 <form method="post" action="GoodsServlet?action=select">
     3     <div>
     4         <div>
     5             <div><label>产品名称</label></div>
     6             <div><input type="text" name="name" id="name"></div>
     7         </div>
     8         <div>
     9             <div><label>日期</label></div>
    10             <div><input type="text" name="date" id="date"></div>
    11         </div>
    12         <div>
    13             <input type="submit" value="查询">
    14         </div>
    15     </div>
    16 </form>
    17 <c:set var="list" value="${sessionScope.l}"></c:set>
    18 <c:if test="${l!=null }">
    19 <c:forEach var="i" begin="0" end="${l.size()-1}">
    20 &nbsp;名称&nbsp;${l[i].getName()}
    21 &nbsp;型号&nbsp;${l[i].getType()}
    22 &nbsp;出产厂家&nbsp;${l[i].getPM()}
    23 &nbsp;规格&nbsp;${l[i].getSpecification()}
    24 &nbsp;数量&nbsp;${l[i].getNumber()}
    25 &nbsp;单位&nbsp;${l[i].getUnits()}
    26 &nbsp;姓名&nbsp;${l[i].getPName()}
    27 &nbsp;操作&nbsp;${l[i].getIo()}
    28 &nbsp;日期&nbsp;${l[i].getDate()}
    29 <br/>
    30 </c:forEach>
    31 </c:if>
    select.jsp

    使用了EL语句和JSTL标签进行遍历

    Java代码:

     1 public List<ListBean> select(String name,String date)
     2     {
     3         List<ListBean> l=new ArrayList<ListBean>();
     4         ListBean b=null;
     5         DB db=new DB();
     6         Connection con = db.getCon();
     7         try
     8         {
     9         Statement stm = con.createStatement();
    10         ResultSet rs = stm.executeQuery("select * from list where name like '%"+name+"%' and date ='"+date+"'");
    11         while(rs.next())
    12         {
    13             b=new ListBean();
    14             b.setName(rs.getString("name"));
    15             b.setPM(rs.getString("PM"));
    16             b.setType(rs.getString("type"));
    17             b.setSpecification(rs.getString("specification"));
    18             b.setNumber(rs.getInt("number"));
    19             b.setUnits(rs.getString("units"));
    20             b.setPName(rs.getString("PName"));
    21             b.setIo(rs.getString("io"));
    22             b.setDate(rs.getString("date"));
    23             l.add(b);
    24         }
    25         } catch (Exception e) 
    26         {
    27         e.printStackTrace();
    28         
    29         }
    30         return l;
    31     }
    ListDao.select(String name,String date)

    GoodsServlet:

    1 protected void select(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    2     {
    3         String name=request.getParameter("name");
    4         String date=request.getParameter("date");
    5         ListDao d=new ListDao();
    6         List<ListBean>l=d.select(name,date);
    7         request.getSession().setAttribute("l", l);
    8         request.getRequestDispatcher("select.jsp").forward(request,response);
    9     }
    View Code

     

    第二部分:商品的增删改查

    首先写好Dao相关的操作函数

      1 public class GoodsDao
      2 {
      3     public boolean delete(String name)
      4     {
      5         DB db=new DB();
      6         Connection con = db.getCon();
      7         try
      8         {
      9         Statement stm = con.createStatement();
     10         stm.execute("delete from goods where name='"+name+"'");
     11         }
     12         catch (Exception e) 
     13         {
     14         e.printStackTrace();
     15         return false;
     16         }
     17         return true;
     18     }
     19     public List<GoodsBean> select(String name)
     20     {
     21         List<GoodsBean> l=new ArrayList<GoodsBean>();
     22         GoodsBean b=null;
     23         DB db=new DB();
     24         Connection con = db.getCon();
     25         try
     26         {
     27         Statement stm = con.createStatement();
     28         ResultSet rs = stm.executeQuery("select * from goods where name like '%"+name+"%'");
     29         while(rs.next())
     30         {
     31             b=new GoodsBean();
     32             b.setName(rs.getString("name"));
     33             b.setPM(rs.getString("PM"));
     34             b.setType(rs.getString("type"));
     35             b.setSpecification(rs.getString("specification"));
     36             b.setNumber(rs.getInt("number"));
     37             l.add(b);
     38         }
     39         } catch (Exception e) 
     40         {
     41         e.printStackTrace();
     42         
     43         }
     44         return l;
     45     }
     46     public boolean insert(GoodsBean g)
     47     {
     48         DB db=new DB();
     49         Connection con = db.getCon();
     50         try
     51         {
     52         Statement stm = con.createStatement();
     53         stm.execute("insert into goods(name,PM,type,specification,number) values ('"+g.getName()+"','"+g.getPM()+"','"+g.getType()+"','"+g.getSpecification()+"',"+g.getNumber()+")");
     54         }
     55         catch (Exception e) 
     56         {
     57         e.printStackTrace();
     58         return false;
     59         }
     60         return true;
     61     }
     62     public boolean update(int number,int i)
     63     {
     64         int num=0;
     65         DB db=new DB();
     66         Connection con = db.getCon();
     67         try
     68         {
     69         Statement stm = con.createStatement();
     70         ResultSet rs =stm.executeQuery("select number from goods where id="+i);
     71         System.out.println("update"+i+"num "+number);
     72         rs.next();
     73         num=rs.getInt("number");
     74         System.out.print(num+"+"+number);
     75         num=num+number;
     76         System.out.println("="+num);
     77         stm.execute("update goods set number="+num+" where id="+i);
     78         }
     79         catch (Exception e) 
     80         {
     81         e.printStackTrace();
     82         return false;
     83         }
     84         return true;
     85     }
     86     public boolean update(String name,GoodsBean b)
     87     {
     88         System.out.println("Dao"+name+b.getName()+b.getType());
     89         DB db=new DB();
     90         Connection con = db.getCon();
     91         try
     92         {
     93         Statement stm = con.createStatement();
     94         stm.execute("update goods set name='"+b.getName()+"',type='"+b.getType()+"',PM='"+b.getPM()+"',specification='"+b.getSpecification()+"' where name='"+name+"'");
     95         }
     96         catch (Exception e) 
     97         {
     98         e.printStackTrace();
     99         return false;
    100         }
    101         return true;
    102     }
    103     public int chick(GoodsBean g)
    104     {
    105         int i=-1;//i>0查询有结果
    106         DB db=new DB();
    107         Connection con = db.getCon();
    108         try
    109         {
    110         Statement stm = con.createStatement();
    111         ResultSet rs =stm.executeQuery("select id from goods where name='"+g.getName()+"' and PM='"+g.getPM()+"' and type='"+g.getType()+"' and specification='"+g.getSpecification()+"'");
    112         if(rs.next())
    113         {
    114             i=rs.getInt("id");
    115         }
    116         } 
    117         catch (Exception e) 
    118         {
    119         e.printStackTrace();
    120         }
    121         return i;
    122     }
    123 }
    GoodsDao

    在修改时,重构一个参数为GoodsBean和name的函数

    然后写servlet(由于之前忘了写这一部分,所以直接起名为GoodsServlet2)

      1 package com.ccr.jsp.servlet;
      2 
      3 import java.io.IOException;
      4 import java.util.List;
      5 
      6 import javax.servlet.ServletException;
      7 import javax.servlet.annotation.WebServlet;
      8 import javax.servlet.http.HttpServlet;
      9 import javax.servlet.http.HttpServletRequest;
     10 import javax.servlet.http.HttpServletResponse;
     11 
     12 import com.ccr.jsp.bean.GoodsBean;
     13 import com.ccr.jsp.bean.ListBean;
     14 import com.ccr.jsp.dao.GoodsDao;
     15 import com.ccr.jsp.dao.ListDao;
     16 
     17 /**
     18  * Servlet implementation class GoodsServlet2
     19  */
     20 @WebServlet("/GoodsServlet2")
     21 public class GoodsServlet2 extends HttpServlet {
     22     private static final long serialVersionUID = 1L;
     23        
     24     /**
     25      * @see HttpServlet#HttpServlet()
     26      */
     27     public GoodsServlet2() {
     28         super();
     29         // TODO Auto-generated constructor stub
     30     }
     31 
     32     /**
     33      * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     34      */
     35     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     36         request.setCharacterEncoding("UTF-8");
     37         response.setCharacterEncoding("UTF-8");
     38         response.setContentType("text/html;charset=UTF-8");
     39         response.setHeader("content-type", "text/html;charset=UTF-8");
     40         String action=request.getParameter("action");
     41         if(action.equals("add"))
     42         {
     43             System.out.println("add");
     44             add(request,response);
     45         }
     46         if(action.equals("delete"))
     47         {
     48             delete(request,response);
     49         }
     50         if(action.equals("update"))
     51         {
     52             update(request,response);
     53         }
     54         if(action.equals("select"))
     55         {
     56             select(request,response);
     57         }
     58         if(action.equals("select2"))
     59         {
     60             select2(request,response);
     61         }
     62     }
     63     protected void add(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
     64     {
     65         int id=-2;
     66         GoodsBean g=new GoodsBean();
     67         GoodsDao gd=new GoodsDao();
     68         g.setName(request.getParameter("name"));
     69         g.setPM(request.getParameter("PM"));
     70         g.setType(request.getParameter("type"));
     71         g.setSpecification(request.getParameter("specification"));
     72         g.setNumber(0);
     73         System.out.println(id);
     74         gd.insert(g);
     75         request.getRequestDispatcher("1.jsp").forward(request,response);
     76     }
     77     protected void delete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
     78     {
     79         String name=request.getParameter("name");
     80         GoodsDao gd=new GoodsDao();
     81         gd.delete(name);
     82         request.getRequestDispatcher("2.jsp").forward(request,response);
     83     }
     84     protected void update(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
     85     {
     86         String name=request.getParameter("name0");
     87         System.out.println("SNAME"+name);
     88         GoodsBean g=new GoodsBean();
     89         GoodsDao gd=new GoodsDao();
     90         g.setName(request.getParameter("name"));
     91         g.setPM(request.getParameter("PM"));
     92         g.setType(request.getParameter("type"));
     93         g.setSpecification(request.getParameter("specification"));
     94         System.out.println(g.getName()+g.getType());
     95         gd.update(name,g);
     96         request.getRequestDispatcher("3.jsp").forward(request,response);
     97     }
     98     protected void select(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
     99     {
    100         String name=request.getParameter("name0");
    101         System.out.println("name="+name);
    102         GoodsDao gd=new GoodsDao();
    103         List<GoodsBean>gl=gd.select(name);
    104         System.out.println(gl.size());
    105         request.getSession().setAttribute("gl", gl);
    106         request.getRequestDispatcher("4.jsp").forward(request,response);
    107     }
    108     protected void select2(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    109     {
    110         String name=request.getParameter("name0");
    111         System.out.println("name="+name);
    112         GoodsDao gd=new GoodsDao();
    113         List<GoodsBean>gl=gd.select(name);
    114         System.out.println(gl.size());
    115         request.getSession().setAttribute("gl", gl);
    116         request.getRequestDispatcher("3.jsp").forward(request,response);
    117     }
    118 }
    GoodsServlet2

    在插入时,直接设置数量为0

    最后设计一下界面。完工!

    总结:

    1、新学习了el语句和JSTL标签库的一些使用,很方便

    2、复制代码很快,但是很容易出错

     

    转载于:https://www.cnblogs.com/CCRNRT/p/10117188.html

    展开全文
  • javaWeb物资管理系统项目源码,有需要的小伙伴可以借鉴一下
  • SQL商品库存管理系统

    2020-12-21 19:30:56
    1系统的目标及任务 5 1.1系统建设目标及主要任务 5 2系统的需求分析 5 2.1系统的详细需求 5 2.2使用环境 9 2.3可行性分析 9 3系统设计 10 3.1概念设计 10 3.2逻辑设计 11 4系统功能模块设计 12 4.1登陆模块 12 4.2增...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 3,979
精华内容 1,591
关键字:

库存物资管理系统