1.首先是建立 商品类 与上一周的课程管理体统类似

package com.hjf.entity;public class Course {private int id;private String name;private String shengc;private String xingh;private String guig;private String shul;private String riq;private String shij;private String ruk;private String songh;public String getsongh() {return songh;}public void setsongh(String songh) {this.songh = songh;}public String getruk() {return ruk;}public void setruk(String ruk) {this.ruk = ruk;}public String getshij() {return shij;}public void setshij(String shij) {this.shij = shij;}public String getriq() {return riq;}public void setriq(String riq) {this.riq = riq;}public String getshul() {return shul;}public void setshul(String shul) {this.shul = shul;}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getshengc() {return shengc;}public void setshengc(String shengch) {this.shengc = shengch;}public String getxingh() {return xingh;}public void setxingh(String xingh) {this.xingh = xingh;}public String getguig() {return guig;}public void setguig(String guig) {this.guig = guig;}public Course() {// TODO 自动生成的构造函数存根
    }public Course(int id, String name, String shengc, String xingh,String guig,String shul,String riq,String shij,String ruk,String songh) {this.id = id;this.name = name;this.shengc = shengc;this.xingh = xingh;this.guig = guig;this.shul = shul;this.riq = riq;this.shij = shij;this.ruk = ruk;this.songh = songh;}public Course(String name, String shengc, String xingh,String guig,String shul,String riq,String shij,String ruk,String songh) {this.name = name;this.shengc = shengc;this.xingh = xingh;this.guig = guig;this.shul = shul;this.riq = riq;this.shij = shij;this.ruk = ruk;this.songh = songh;}
}

2.然后是dao层的增删改查

package com.hjf.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.hjf.entity.Course;
import com.hjf.util.DBUtil;/*** 课程Dao* Dao层操作数据* @author xie* **/
public class CourseDao {/*** 添加* @param course* @return*/public boolean add(Course course) {String sql = "insert into course(name, shengc, xingh,guig,shul,riq,shij,ruk,songh) values('" + course.getName() + "','" + course.getshengc() + "','" + course.getxingh() + "','" + course.getguig()+ "','" + course.getshul() + "','" + course.getriq()+ "','" + course.getshij()+ "','" + course.getruk()+ "','" + course.getsongh() + "')";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;}/*** 删除* * @param id* @return*/public boolean delete (int id) {boolean f = false;String sql = "delete from course where id='" + id + "'";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;}/*** 修改* @param name* @param pass*/public boolean update(Course course) {String sql = "update course set name='" + course.getName() + "', shengc='" + course.getshengc() + "', xingh='" + course.getxingh()+"',guig='" + course.getguig()+"',shul='" + course.getshul()+"',riq='" + course.getriq()+"',shij='" + course.getshij()+"',ruk='" + course.getruk()+"',songh='" + course.getsongh()            + "' where id='" + course.getId() + "'";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;}/*** @param name* @return*/public boolean name(String name) {boolean flag = false;String sql = "select name from course 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;}/*** 通过ID得到类* @param id* @return*/public Course getCourseById(int id) {String sql = "select * from course where id ='" + id + "'";Connection conn = DBUtil.getConn();Statement state = null;ResultSet rs = null;Course course = null;try {state = conn.createStatement();rs = state.executeQuery(sql);while (rs.next()) {String name = rs.getString("name");String shengc = rs.getString("shengc");String xingh = rs.getString("xingh");String guig = rs.getString("guig");String shul = rs.getString("shul");String riq = rs.getString("riq");String shij = rs.getString("shij");String ruk = rs.getString("ruk");String songh = rs.getString("songh");course = new Course(id, name, shengc,xingh,guig,shul,riq,shij,ruk,songh);}} catch (Exception e) {e.printStackTrace();} finally {DBUtil.close(rs, state, conn);}return course;}/*** 通过name得到Course* @param name* @return*/public Course getCourseByName(String name) {String sql = "select * from course where name ='" + name + "'";Connection conn = DBUtil.getConn();Statement state = null;ResultSet rs = null;Course course = null;try {state = conn.createStatement();rs = state.executeQuery(sql);while (rs.next()) {int id = rs.getInt("id");String shengc = rs.getString("shengc");String xingh = rs.getString("xingh");String guig = rs.getString("guig");String shul = rs.getString("shul");String riq = rs.getString("riq");String shij = rs.getString("shij");String ruk = rs.getString("ruk");String songh = rs.getString("songh");course = new Course(id, name, shengc,xingh,guig,shul,riq,shij,ruk,songh);}} catch (Exception e) {e.printStackTrace();} finally {DBUtil.close(rs, state, conn);}return course;}/*** 查找*/public List<Course> search(String name, String riq,String songh) {String sql = "select * from course where 1=1 ";if (name != "") {sql += "and name like '%" + name + "%'";}if (riq != "") {sql += "and riq like '%" + riq+ "%'";}if (songh != "") {sql += "and songh like '%" + songh+ "%'";}List<Course> list = new ArrayList<>();Connection conn = DBUtil.getConn();Statement state = null;ResultSet rs = null;try {state = conn.createStatement();rs = state.executeQuery(sql);Course bean = null;while (rs.next()) {int id = rs.getInt("id");String name2 = rs.getString("name");String shengc2 = rs.getString("shengc");String xingh2 = rs.getString("xingh");String guig2 = rs.getString("guig");String shul2 = rs.getString("shul");String riq2 = rs.getString("riq");String shij2 = rs.getString("shij");String ruk2 = rs.getString("ruk");String songh2 = rs.getString("songh");bean = new Course(id, name2, shengc2,xingh2,guig2,shul2,riq2,shij2,ruk2,songh2);list.add(bean);}} catch (SQLException e) {e.printStackTrace();} finally {DBUtil.close(rs, state, conn);}return list;}/*** 全部数据*/public List<Course> list() {String sql = "select * from course";List<Course> list = new ArrayList<>();Connection conn = DBUtil.getConn();Statement state = null;ResultSet rs = null;try {state = conn.createStatement();rs = state.executeQuery(sql);Course bean = null;while (rs.next()) {int id = rs.getInt("id");String name2 = rs.getString("name");String shengc2 = rs.getString("shengc");String xingh2 = rs.getString("xingh");String guig2 = rs.getString("guig");String shul2 = rs.getString("shul");String riq2 = rs.getString("riq");String shij2 = rs.getString("shij");String ruk2 = rs.getString("ruk");String songh2 = rs.getString("songh");bean = new Course(id, name2, shengc2,xingh2,guig2,shul2,riq2,shij2,ruk2,songh2);list.add(bean);}} catch (SQLException e) {e.printStackTrace();} finally {DBUtil.close(rs, state, conn);}return list;}}

3.service接口

package com.hjf.service;import java.util.List;import com.hjf.dao.CourseDao;
import com.hjf.entity.Course;/*** CourseService* 服务层* @author Hu**/
public class CourseService {CourseDao cDao = new CourseDao();/*** 添加* @param course* @return*/public boolean add(Course course) {boolean f = false;if(!cDao.name(course.getName())) {cDao.add(course);f = true;}return f;}/*** 删除*/public void del(int id) {cDao.delete(id);}/*** 修改* @return */public void update(Course course) {cDao.update(course);}/*** 通过ID得到一个Course* @return */public Course getCourseById(int id) {return cDao.getCourseById(id);}/*** 通过Name得到一个Course* @return */public Course getCourseByName(String name) {return cDao.getCourseByName(name);}/*** 查找* @return */public List<Course> search(String name,String riq,String songh) {return cDao.search( name,riq,songh);}/*** 全部数据* @return */public List<Course> list() {return cDao.list();}
}

4.severlet 层 不用更改

package com.hjf.servlet;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.hjf.entity.Course;
import com.hjf.service.CourseService;@WebServlet("/CourseServlet")
public class CourseServlet extends HttpServlet {private static final long serialVersionUID = 1L;CourseService service = new CourseService();/*** 方法选择*/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 ("getcoursebyid".equals(method)) {getCourseById(req, resp);} else if ("getcoursebyname".equals(method)) {getCourseByName(req, resp);} else if ("list".equals(method)) {list(req, resp);}}/*** 添加* @param req* @param resp* @throws IOException * @throws ServletException */private void add(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {req.setCharacterEncoding("utf-8");String name = req.getParameter("name");String shengc = req.getParameter("shengc");String xingh = req.getParameter("xingh");String guig = req.getParameter("guig");String shul = req.getParameter("shul");String riq = req.getParameter("riq");String shij = req.getParameter("shij");String ruk = req.getParameter("ruk");String songh = req.getParameter("songh");Course course = new Course( name, shengc,xingh,guig,shul,riq,shij,ruk,songh);//添加后消息显示if(service.add(course)) {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<Course> courses = service.list();req.setAttribute("courses", courses);req.getRequestDispatcher("list.jsp").forward(req,resp);}/*** 通过ID得到Course* @param req* @param resp* @throws ServletException */private void getCourseById(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{req.setCharacterEncoding("utf-8");int id = Integer.parseInt(req.getParameter("id"));Course course = service.getCourseById(id);req.setAttribute("course", course);req.getRequestDispatcher("detail2.jsp").forward(req,resp);}/*** 通过名字查找* 跳转至删除* @param req* @param resp* @throws IOException* @throws ServletException */private void getCourseByName(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{req.setCharacterEncoding("utf-8");String name = req.getParameter("name");Course course = service.getCourseByName(name);if(course == null) {req.setAttribute("message", "查无此商品!");req.getRequestDispatcher("del.jsp").forward(req,resp);} else {req.setAttribute("course", course);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");int id = Integer.parseInt(req.getParameter("id"));service.del(id);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");int id = Integer.parseInt(req.getParameter("id"));String name = req.getParameter("name");String shengc = req.getParameter("shengc");String xingh = req.getParameter("xingh");String guig = req.getParameter("guig");String shul = req.getParameter("shul");String riq = req.getParameter("riq");String shij = req.getParameter("shij");String ruk = req.getParameter("ruk");String songh = req.getParameter("songh");Course course = new Course(id, name, shengc,xingh,guig,shul,riq,shij,ruk,songh);service.update(course);req.setAttribute("message", "修改成功");req.getRequestDispatcher("CourseServlet?method=list").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 riq = req.getParameter("riq");String songh = req.getParameter("songh");List<Course> courses = service.search( name, riq,songh);req.setAttribute("courses", courses);req.getRequestDispatcher("searchlist.jsp").forward(req,resp);}
}

5.数据可的连接

package com.hjf.util;
//数据库连接
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;/*** 数据库连接工具* @author Zheng**/
public class DBUtil {public static String db_url = "jdbc:mysql://localhost:3306/course?useSSL=false";public static String db_user = "root";public static String db_pass = "root";public static Connection getConn () {Connection conn = null;try {Class.forName("com.mysql.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();}}}}

数据库的建立

到这里 Java的代码就完成了

下面是网页界面 的代码

1首先是主界面

<%@ 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="CourseServlet?method=list">商品信息修改</a></div><div class="a"><a href="del.jsp">商品信息删除</a></div><div class="a"><a href="search.jsp">商品信息查询</a></div></div>
</body>
</html>

2.增加界面

<%@ 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="CourseServlet?method=add" method="post" οnsubmit="return check()"><div class="a">商品名称<input type="text" id="name" name="name"/></div><div class="a">生产厂家<input type="text" id="shengc" name="shengc" /></div><div class="a">型号<input type="text" id="xingh" name="xingh" /></div><div class="a">规格<input type="text" id="guig" name="guig" /></div><div class="a">数量<input type="text" id="shul" name="shul" /></div><div class="a">日期<input type="text" id="riq" name="riq" /></div><div class="a">时间<input type="text" id="shij" name="shij" /></div><div class="a">入库单位<input type="text" id="ruk" name="ruk" /></div><div class="a">送货人<input type="text" id="songh" name="songh" /></div><div class="a"><button type="submit" class="b">保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</button></div></form></div><script type="text/javascript">function check() {var name = document.getElementById("name");;var shengc = document.getElementById("shengc");var xingh = document.getElementById("xingh");var guig=document.getElementById("guig");var shul=document.getElementById("shul");var riq=document.getElementById("riq");var ruk=document.getElementById("ruk");var songh=document.getElementById("songh")//非空if(name.value == '') {alert('商品名称为空');name.focus();return false;}if(shengc.value == '') {alert('生产场地为空');shengc.focus();return false;}if(xingh.value == '') {alert('型号为空');xingh.focus();return false;}if(guig.value == '') {alert('规格为空');guig.focus();return false;}if(shul.value == '') {alert('shul为空');shul.focus();return false;}if(riq.value == '') {alert('上课地点为空');riq.focus();return false;}if(shij.value == '') {alert('课程名称为空');shij.focus();return false;}if(ruk.value == '') {alert('教师为空');ruk.focus();return false;}if(songh.value == '') {alert('上课地点为空');songh.focus();return false;}}</script>    </body></html>

3.删除界面

<%@ 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="CourseServlet?method=getcoursebyname" method="post" οnsubmit="return check()"><div class="a">商品名称<input type="text" id="name" name="name"/></div><div class="a"><button type="submit" class="b">查&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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>

删除前的显示界面

<%@ 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="CourseServlet?method=getcoursebyname" method="post" οnsubmit="return check()"><div class="a">商品名称<input type="text" id="name" name="name"/></div><div class="a"><button type="submit" class="b">查&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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>

修改界面

<%@ 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="CourseServlet?method=update" method="post" οnsubmit="return check()"><div class="a">商品名称<input type="text" id="name" name="name" value="${course.name}"/></div><div class="a">生产商家<input type="text" id="shengc" name="shengc" value="${course.shengc}"/></div><div class="a">型号<input type="text" id="xingh" name="xingh" value="${course.xingh}"/></div><div class="a">规格<input type="text" id="guig" name="guig" value="${course.guig}"/></div><div class="a">数量<input type="text" id="shul" name="shul" value="${course.shul}"/></div><div class="a">日期<input type="text" id="riq" name="riq" value="${course.riq}"/></div><div class="a">时间<input type="text" id="shij" name="shij" value="${course.shij}"/></div><div class="a">入库单为<input type="text" id="ruk" name="ruk" value="${course.ruk}"/></div><div class="a">送货人<input type="text" id="songh" name="songh" value="${course.songh}"/></div><input type="hidden" id="id" name="id" value="${course.id}"/><div class="a"><button type="submit" class="b">修&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;改</button></div></form></div><script type="text/javascript">function check() {var name = document.getElementById("name");;var shengc = document.getElementById("shengc");var xingh = document.getElementById("xingh");var guig=document.getElementById("guig");var shul=document.getElementById("shul");var riq=document.getElementById("riq");var ruk=document.getElementById("ruk");var songh=document.getElementById("songh")}</script>
</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><table class="tb"><tr><td>id</td><td>商品名称</td><td>型号</td><td>规格</td><td>数量</td><td>日期</td><td>时间</td><td>入库单位</td><td>送货人</td><td align="center" colspan="2">操作</td></tr><c:forEach items="${courses}" var="item"><tr><td>${item.id}</td><td>${item.name}</td><td>${item.xingh}</td><td>${item.guig}</td><td>${item.riq}</td><td>${item.shij}</td><td>${item.ruk}</td><td>${item.songh}</td><td><a href="CourseServlet?method=getcoursebyid&id=${item.id}">修改</a></td></tr></c:forEach></table></div>
</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><div align="center"><h1 style="color: red;">商品信息查询</h1><a href="index.jsp">返回主页</a><form action="CourseServlet?method=search" method="post" οnsubmit="return check()"><div class="a">商品名称<input type="text" id="name" name="name"/></div><div class="a">日期<input type="text" id="riq" name="riq" /></div><div class="a">送货人<input type="text" id="songh" name="songh" /></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");;var riq = document.getElementById("riq");var songh = document.getElementById("songh");//非空if(name.value == '' && riq.value == '' && songh.value == '') {alert('请填写一个条件');return false;}}</script>
</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><div align="center"><h1 style="color: red;">课程信息列表</h1><a href="index.jsp">返回主页</a><table class="tb"><tr><td>id</td><td>商品名称</td><td>生产厂家</td><td>型号</td><td>规格</td><td>数量</td><td>日期</td><td>时间</td><td>入库单位</td><td>送货人</td></tr><!-- forEach遍历出adminBeans --><c:forEach items="${courses}" var="item" varStatus="status"><tr><td>${item.id}</td><td><a>${item.name}</a></td><td>${item.shengc}</td><td>${item.xingh}</td><td>${item.guig}</td><td>${item.shul}</td><td><a>${item.riq}</a></td><td>${item.shij}</td><td>${item.ruk}</td><td><a>${item.songh}</a></td></tr></c:forEach></table></div>
</body>
</html>

数据库的增删该查要每个方法都连接上数据库

连接上数据库 每次的 类中的变量 都要准确同一 错一处就很难找出来 还会报错 ;

转载于:https://www.cnblogs.com/1983185414xpl/p/10116741.html

12-13 库存信息管理系统相关推荐

  1. java库存信息管理系统_Java商户管理系统 客户管理 库存管理 销售报表 SSM项目源码...

    系统介绍: 1.系统采用主流的 SSM 框架 jsp JSTL bootstrap html5 (PC浏览器使用) 2.springmvc +spring4.3.7+ mybaits3.3  SSM ...

  2. 学生管理系统java mysql_学生信息管理系统 基于Java+mysql开发的学生管理系统 - 下载 - 搜珍网...

    压缩包 : 学生信息管理系统.zip 列表 学生信息管理系统/ 学生信息管理系统/build/ 学生信息管理系统/build.xml 学生信息管理系统/build/built-jar.properti ...

  3. 12.寻光集后台管理系统-库存信息(后端)

    有了产品信息之后,下面来写库存信息部分 每一个库存的入库和出库都需要对应一个产品,所以产品信息是它的外键 库存信息 创建App python manage.py startapp warehouse ...

  4. HTML+CSS+JS`管理系统网站设计——学生信息管理系统模板 (13页) HTML+CSS+JavaScript html网页设计期末大作业_网页设计平时作业

    HTML5期末大作业:管理系统网站设计--学生信息管理系统模板 (13页) HTML+CSS+JavaScript html网页设计期末大作业_网页设计平时作业 常见网页设计作业题材有 个人. 美食. ...

  5. HTML5期末大作业:管理系统网站设计——学生信息管理系统模板 (13页) HTML+CSS+JavaScript html网页设计期末大作业_网页设计平时作业

    HTML5期末大作业:管理系统网站设计--学生信息管理系统模板 (13页) HTML+CSS+JavaScript html网页设计期末大作业_网页设计平时作业 常见网页设计作业题材有 个人. 美食. ...

  6. Java课程设计报告--绩效考核信息管理系统

     Java课程设计报告 题目      绩效考核信息管理系统    学生姓名         学    号                   院    系        年级专业计算机科学与技术 班 ...

  7. 医院信息管理系统(Python与MySQL数据库的连接与相关增删改查操作)

    题目意义 医院信息管理是一项琐碎.复杂而又十分细致的工作,这关系到医院体系能否运行起来这一关乎国民健康水平的重大问题.我们只有利用好了医院中每个医生.护士的各项资源,才能使得医院系统能够有序而条理的进 ...

  8. springboot+党员信息管理系统 毕业设计-附源码161528

    基于Springboot的党员信息管理系统 摘 要 由于数据库和数据仓库技术的快速发展,学校党员信息系统建设越来越向模块化.智能化.自我服务和管理科学化的方向发展.党员信息管理系统除了具有共享系统的全 ...

  9. java计算机毕业设计Web医学院校大学生就业信息管理系统源码+mysql数据库+系统+lw文档+部署

    java计算机毕业设计Web医学院校大学生就业信息管理系统源码+mysql数据库+系统+lw文档+部署 java计算机毕业设计Web医学院校大学生就业信息管理系统源码+mysql数据库+系统+lw文档 ...

  10. net-java-php-python-班级信息管理系统计算机毕业设计程序

    net-java-php-python-班级信息管理系统计算机毕业设计程序 net-java-php-python-班级信息管理系统计算机毕业设计程序 本源码技术栈: 项目架构:B/S架构 开发语言: ...

最新文章

  1. usaco ★Zero Sum 和为零
  2. WPF Effect 造成的字体模糊
  3. 关于函数形参的一些讨论
  4. java 基本数据类型及自己主动类型提升
  5. 基于Amarok的跨平台音乐播放器:Clementine mac版
  6. Python实现图像直方图均衡化算法
  7. break 和 continue 语句, 以及循环中的 else 子句
  8. iQOO Neo5入网:搭载双电芯方案 标配66W快充
  9. 列出选定月份的时间序列
  10. 如何在Azure Data Studio中导出数据库?
  11. 信息 按顺序打印commit_Git 工作流,看这一篇就够了
  12. 装饰模式 DecoratePattern
  13. POJ 1838 Banana G++
  14. 一级建造师资格审核需要提交哪些材料?
  15. CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirror.tuna.tsinghua.edu.cn/anaconda/pkg
  16. 《代码阅读》读书笔记(一)
  17. Java实现本机IP的修改和获取
  18. 秉火429笔记之三GPIO框图剖析
  19. html的表单与按钮学习
  20. 计量经济学复习笔记(1)

热门文章

  1. Struts2之访问ServletAPI
  2. [渝粤教育] 云南大学 內部控制理论与实务 参考 资料
  3. 线性模型第3讲:Lasso方法
  4. Baxter实战 (三)ubuntu14.04安装Baxter Simulator
  5. 32位的tetview and medit 在64bit的linux运行,有很多32bit的库没有安装,错误不断之解决办法。
  6. 容器平台选型的十大模式:Docker、DC/OS、K8S 谁与当先?
  7. [转]BVH文件介绍
  8. httpclient请求服务的各种方法实例
  9. 跨域问题及jQuery中Ajax传参的讲解
  10. h5前期js知识点10月16日总结