我把该实验的源码和数据库上传到了资源里,你们要的直接点击链接下载就行,如果链接被吞,麻烦评论我一下,我在再次上传。

https://download.csdn.net/download/fenger_c/12545951

我已经有一个多月没有好好打理博客了,很多人要源码,邮箱、qq、私信、评论都有收到,但是很抱歉我实在太忙了,没有时间好好的一个一个发个你们,所以大家有需要的,就点击上方的下载链接把,其他方式我怕是无能为力了。

再次感到抱歉~

想上传视频来着,觉得太麻烦,我就直接截图吧。购物车的基本功能都实现了,比如在商品显示在页面上,对了,我的图像,是放路径的,放图片的同学可以把自己的图片换上,加入购物车的时候,判断该商品是否在购物车内,是的话直接加1 ,不是直接插入,用到了虚拟账户,多少钱自己充,购买之后更新订单表,购物车表清空,商品表的库存也相应减少。其他的有些功能没有实现,可能里面还有写无关要的代码,那些可以删,当初想搞全面一点但是精力有限。

我之前上传了资源,但是不久都会被吞掉,如果有同学需要源代码和数据库源文件,请私信或者评论下直接留个邮箱,我看到会直接发的。

注意,根据自己的实际情况改以下数据库连接部分的代码,比如数据库名,数据库密码和用户名等,我的代码是没错的,如果测试有出错看是否是连接部分是否出错以及容器组件,jdk版本,tomcat版本,sql版本等等。

shop.product  商品表

shop.shopcart购物车表 

订单表shop.order

 

DataBaseConnection.java(连接数据库) 

package test5;
import java.sql.*;public class DataBaseConnection {private static String driverStr="com.mysql.jdbc.Driver";//驱动列表private static String connStr="jdbc:mysql://localhost/mySql";//mySql是我自己的数据库名private static String dbusername="root";//数据库用户名private static String dbpassword="12345678";//密码和数据库一致 private static Connection conn=null;//数据库的连接对象private Statement stmt=null;//创建Statement对象public DataBaseConnection() {       }
//一个静态方法,返回一个数据库的连接,这样达到了对数据库连接统一控制的目的public static Connection getConnection() throws SQLException {try{Class.forName(driverStr);//加载驱动程序conn = DriverManager.getConnection(connStr,dbusername, dbpassword);//连接数据库          }catch(Exception ex){System.out.println("无法同数据库建立连接!");}       return conn;}public int executeUpdate(String s){int result=0;try{stmt = conn.createStatement();//创建Statement语句result=stmt.executeUpdate(s);//执行更新语句}catch(Exception ex){System.out.println("执行更新错误!");}return result;}public ResultSet executeQuery(String s){ResultSet rs=null;try{rs=stmt.executeQuery(s);}//执行查询语句catch(Exception ex){System.out.println("执行查询错误!");}return rs;}public void close()//关闭与数据库的连接{try{stmt.close();conn.close();}catch(Exception e){}}public static void main(String[] args) {try {Connection conn=DataBaseConnection.getConnection();if(conn!=null){System.out.println("连接数据库正常");}else {System.out.println("连接数据库异常");}} catch (Exception ex) {// TODO: handle exceptionex.printStackTrace();}}}

product.java (商品类)

package test5;
//商品类
public class product {private int id;//商品编号private String name;//商品名称private String msg;//商品信息private int price;//商品价格private String type;//商品类型private int quantity;//商品库存private String picture;//商品图片private int num;//购买同一件商品的数量private int totalprice;//购买同款商品的总价格public int getTotalprice() {     return totalprice;}public void setTotalprice(int totalprice) {this.totalprice = totalprice;}public int getNum() {return num;}public void setNum(int num) {this.num = num;}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 getMsg() {return msg;}public void setMsg(String msg) {this.msg = msg;}public int getPrice() {return price;}public void setPrice(int price) {this.price = price;}public String getType() {return type;}public void setType(String type) {this.type = type;}public int getQuantity() {return quantity;}public void setQuantity(int quantity) {this.quantity = quantity;}public String getPicture() {return picture;}public void setPicture(String picture) {this.picture = picture;}}

Product_clo.java(获取商品表中的全部信息和购物车表中商品id)

package test5;import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;public class Product_clo {ArrayList<Integer> list = new ArrayList<Integer>();// 获得所有商品的全部信息public ArrayList<product> getAllProduct() {Connection conn = null;PreparedStatement stmt = null;ResultSet rs = null;ArrayList<product> list = new ArrayList<product>();// 把商品信息放列表里try {conn = DataBaseConnection.getConnection();String sql = "select * from shop.product;";stmt = conn.prepareStatement(sql);rs = stmt.executeQuery();while (rs.next()) {product product = new product();product.setId(rs.getInt("product_id"));product.setName(rs.getString("product_name"));product.setMsg(rs.getString("product_msg"));product.setPrice(rs.getInt("product_price"));product.setType(rs.getString("product_type"));product.setQuantity(rs.getInt("product_quantity"));product.setPicture(rs.getString("product_picture"));list.add(product);// 把一个商品的所有信息加入列表}return list;} catch (Exception ex) {ex.printStackTrace();return null;} finally {// 释放数据集对象if (rs != null) {try {rs.close();rs = null;} catch (Exception ex) {// TODO: handle exceptionex.printStackTrace();}}// 释放语句对象if (stmt != null) {try {stmt.close();stmt = null;} catch (Exception ex) {// TODO: handle exceptionex.printStackTrace();}}}}// 获取购物车商品的idpublic ArrayList<Integer> getCartId() {Connection conn = null;PreparedStatement stmt = null;ResultSet rs = null;try {conn = DataBaseConnection.getConnection();String sql = "select product_id from shop.shopcart;";// SQL语句stmt = conn.prepareStatement(sql);rs = stmt.executeQuery();while (rs.next()) {list.add(rs.getInt(1));// 把一个商品的所有信息加入列表}return list;} catch (Exception ex) {ex.printStackTrace();return null;} finally {// 释放数据集对象if (rs != null) {try {rs.close();rs = null;} catch (Exception ex) {// TODO: handle exceptionex.printStackTrace();}}// 释放语句对象if (stmt != null) {try {stmt.close();stmt = null;} catch (Exception ex) {// TODO: handle exceptionex.printStackTrace();}}}}private PreparedStatement setInt(int i, int j) {// TODO Auto-generated method stubreturn null;}private PreparedStatement setString(int i, String name) {// TODO Auto-generated method stubreturn null;}
}

frame.jsp(框架布局)

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>在线购物</title>
</head>
<frameset rows="20%,*"><frame noresize="noresize" src="top.jsp"><frameset cols="15%,*"><frame noresize="noresize" src="left.jsp"><frame noresize="noresize" src="shop.jsp"></frameset>
</frameset>
<body><%String username = request.getParameter("username");String pwd = request.getParameter("pwd");session.setAttribute("username", username);session.setAttribute("pwd", pwd);%>
</body>
</html>

shop.jsp(商品页面表)

<%@page import="test5.product"%>
<%@page import="test5.Product_clo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>在线购物</title>
<style type="text/css">
body {background-color: #FFCCCC;
}img {width: 300px;height: 400px;
}
</style></head>
<body><jsp:useBean id="db" scope="application"class="test5.DataBaseConnection"></jsp:useBean><form action="shopcart.jsp?op=add" method="post"><table><tr><!-- 遍历商品全部信息 --><%String op, name, type, msg;int price, quantity;int id;Product_clo clo = new Product_clo();ArrayList<product> list = clo.getAllProduct();if (list != null && list.size() > 0) {for (int i = 0; i < list.size(); i++) {product pro = list.get(i);id = pro.getId();name = pro.getName();price = pro.getPrice();type = pro.getType();msg = pro.getMsg();quantity = pro.getQuantity();%><td><img alt="商品图片" src="/img/<%=pro.getPicture()%>"></td><td><dd>商品名称:<%=name%></dd> <br><dd>商品价格:?<%=price%></dd> <br><dd>商品类型:<%=type%></dd> <br><dd>商品介绍:<%=msg%></dd> <br><dd>商品数量:<%=quantity%></dd> <br><dd><a href='shopcart.jsp?op=add&id=<%=id%>&name=<%=name%>&price=<%=price%>'>加入购物车</a></dd> <!-- <input type="submit" name="submit" value="加入购物车"> <br> --></td></tr><%}}%></table><br></form></body>
</html>

shopcart.jsp(处理查改增删)

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8" import="java.util.*" import="java.sql.*"%>
<%@page import="test5.product"%>
<%@page import="test5.Product_clo"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>我的购物车</title>
</head>
<body><jsp:useBean id="db" scope="application"class="test5.DataBaseConnection"></jsp:useBean><%String proid = request.getParameter("id");//从购物页面获取的商品idString proname = request.getParameter("name");String proprice = request.getParameter("price");String op = request.getParameter("op");ResultSet rs = null;Connection conn = null;PreparedStatement stmt = null;conn = db.getConnection();Product_clo clo = new Product_clo();String sql = null;ArrayList<Integer> list = new ArrayList();try {//将所选商品加入购物车表中if (op.equals("add")) {list = clo.getCartId();//链表存的是购物车商品的idint pid = 0;int num = 0;int totalprice = 0;pid = Integer.parseInt(proid);//从购物页面传过来的id,强转int后面好比较int cartid = 0;int price = 0;if (list.contains(pid)) {//如果链表里有,那说明该商品已经存在于购物车,在数量上加1即可//得先从购物车把该商品id的相关的数量和价格查询出来sql = "select product_price,cart_product_quantity from shop.shopcart where product_id="+pid;stmt = conn.prepareStatement(sql);rs = stmt.executeQuery(sql);while(rs.next()){price = rs.getInt(1);num = rs.getInt(2);}num = num + 1;//再此基础上加1totalprice = price * num;//更新该商品的总价sql = "update shop.shopcart set cart_product_quantity = ?, totalprice = ?  where product_id=?;";stmt = conn.prepareStatement(sql);stmt.setInt(1, num);stmt.setInt(2, totalprice);stmt.setInt(3, pid);stmt.executeUpdate();out.print("pid = cartid");response.sendRedirect("buy.jsp");//重定向到购物车stmt.close();conn.close();} else {//没有购物车匹配不到该商品则直接插入sql = "insert into shop.shopcart(product_id,product_name,product_price,cart_product_quantity,totalprice) values(?,?,?,?,?);";stmt = conn.prepareStatement(sql);stmt.setString(1, proid);stmt.setString(2, proname);stmt.setString(3, proprice);stmt.setInt(4, 1);stmt.setString(5, proprice);stmt.executeUpdate();stmt.close();conn.close();response.sendRedirect("buy.jsp");}}//在购物车中删除商品if (op.equals("del")) {int id = Integer.parseInt(request.getParameter("id"));sql = "delete from shop.shopcart where product_id=?;";stmt = conn.prepareStatement(sql);stmt.setInt(1, id);stmt.executeUpdate();stmt.close();conn.close();response.sendRedirect("buy.jsp");}//更改商品的数量if (op.equals("update")) {int totalprice = 0;int total = 0;int id = Integer.parseInt(request.getParameter("id"));int num = Integer.parseInt(request.getParameter("num"));int price = Integer.parseInt(request.getParameter("price"));totalprice = price * num;sql = "update shop.shopcart set cart_product_quantity = ?, totalprice = ?  where product_id=?;";stmt = conn.prepareStatement(sql);stmt.setInt(1, num);stmt.setInt(2, totalprice);stmt.setInt(3, id);stmt.executeUpdate();stmt.close();conn.close();response.sendRedirect("buy.jsp");}//清空购物车if (op.equals("clear")) {sql = "delete from shop.shopcart;";stmt = conn.prepareStatement(sql);stmt.executeUpdate();stmt.close();//关闭数据库连接conn.close();//重定向到购物车页面response.sendRedirect("buy.jsp");}} catch (Exception ex) {ex.printStackTrace();}%>
</body>
</html>

buy.jsp(购物车页面)

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8" import="java.util.*" import="java.sql.*"%>
<%@page import="test5.product"%>
<%@page import="test5.Product_clo"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>我的购物车</title>
<style type="text/css">
body {background-color: #FFCCCC;
}th, td {text-align: center;
}
</style><script type="text/javascript">function updateNum(id, num, price) {var quantity=document.getElementById("quantity").value;var qua = parseInt(quantity);var n = parseInt(num);var reg=/^[0-9]*[1-9][0-9]*$/;//只能输入正整数的正则表达式if(!reg.test(num)){alert("只能输入正整数!");num=1;}if(n>qua){alert("库存不足!");num=1;}var url = "shopcart.jsp?op=update&id=" + id + "&num=" + num + "&price="+ price;window.location = url;    }//其实这复选框功能在这个实验并卵用,我没有太多的精力去实验了。这个复选框可以不要的//按全选框则选择所有复选框function selectAll() {var oInput = document.getElementsByName("cartCheckBox");for (var i = 0; i < oInput.length; i++) {oInput[i].checked = document.getElementById("allCheckBox").checked;}}//如果有其中一个没有被选中,则取消全选框,或全部复选框选中,则全选框也选中function selectSingle() {var k = 0;var oInput = document.getElementsByName("cartCheckBox");for (var i = 0; i < oInput.length; i++) {if (oInput[i].checked == false) {k = 1;break;}}if (k == 0) {document.getElementById("allCheckBox").checked = true;} else {document.getElementById("allCheckBox").checked = false;}}
</script>
</head>
<body><h2>我的购物车</h2><hr><jsp:useBean id="db" scope="application"class="test5.DataBaseConnection"></jsp:useBean><form method="post" action="pay.jsp"><table style="width:600px; background-color:#FFCCCC"><%!int total=0;int s; %><tr><td class="title_1"><input id="allCheckBox" type="checkbox"value="" onclick="selectAll()" />全选</td><td>商品名称</td><td>商品单价</td><td>购买数量</td><td>购买金额</td><td>编辑</td><td></td></tr><%try {int quantity = 0;ResultSet rs = null;Connection conn = null;PreparedStatement stmt = null;Statement stmts = null;String id = null;String sql=null;String inputid = null;conn = db.getConnection();Product_clo clo = new Product_clo();ArrayList<product> list = clo.getAllProduct();if (list != null && list.size() > 0) {for (int i = 0; i < list.size(); i++) {product pro = list.get(i);quantity = pro.getQuantity();}}sql = "select * from shop.shopcart;";stmt = conn.prepareStatement(sql);rs = stmt.executeQuery();int t = 0;String name = null;String price = null;int num = 0;String totalprice = null;int to;while (rs.next()) {//显示在购物车里到商品信息id = rs.getString("product_id");name = rs.getString("product_name");price = rs.getString("product_price");num = rs.getInt("cart_product_quantity");totalprice = rs.getString("totalprice");%><tr><td class="cart_td_1"><input name="cartCheckBox"type="checkbox" value="product1" onclick="selectSingle()" /></td><td><%=name%></td><td align="center"><%=price%></td><%out.println("<td><input type=text size=8 name=num id=num value=" + num + " onChange=\"updateNum('" + id + "',this.value,'"+ price + "')\" ></td>");%><td><%=totalprice%></td><td><a href='shopcart.jsp?op=del&id=<%=id%>'>删除</a></td><td><input type="hidden" name="quantity" id="quantity"value="<%=quantity%>" /></td></tr><%}sql = "select sum(totalprice) from shop.shopcart;";//算全部商品总价stmts = conn.createStatement();rs = stmts.executeQuery(sql);while (rs.next()) {total=rs.getInt(1);}session.setAttribute("total",total);s=(Integer)session.getAttribute("total");%></tr><%stmt.close();//关闭数据库连接conn.close();} catch (Exception ex) {ex.printStackTrace();}%><% %></table><img alt="购买" src="/img/buy.jpg" width="50" hight="50">商品总价:<%=s%> 元<input type="submit" value="立即购买"  /> </form><br><a href="shop.jsp">继续购物</a><a href="shopcart.jsp?op=clear">清空购物车</a>
</body>
</html>

pay.jsp(支付界面)

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>支付界面</title>
<style>
body {background-color: #FFCCCC;width: 400px;padding: 250px;text-align: center;margin: auto;
}div {font-size: 20px;
}
</style>
</head>
<body><%Integer a = (Integer) session.getAttribute("a");//账户余额Integer total = (Integer) session.getAttribute("total");//支付金额if (session.getAttribute("a") == null) {a = 0;} if (a >= total) {a = a - total;session.setAttribute("a", a);%><div>支付成功!正在生成订单...</div><%response.setHeader("Refresh", "3;url=order.jsp"); //3秒跳转到支付订单} else {%><div>余额不足!请充值或者返回购物车<br><br> <a href="money.jsp" target="_parent">账户充值</a> <br> <br><a href="buy.jsp">返回购物车</a> <br> <br></div><%}%>
</body>
</html>

money.jsp(充钱)

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" import="java.util.*" import="java.lang.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>账户充值</title>
<style type="text/css">
body {background-color: #FFCCCC;width: 400px;padding: 250px;text-align: center;margin: auto;
}</style></head>
<body><form method="post" action=""><table align="center"><span style="font-size: 20px">充值金额:</span><input style="font-size: 20px" type="text" name="a" size=15maxlength="15" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"><input type="submit" value="确认充值"></table><%int mo;int mon;if (session.getAttribute("a") == null) {mo = 0;mon=0;} else {mo = (Integer) session.getAttribute("a");}String a = request.getParameter("a");//  取得文本框的值if (a == null || a == "") {a = "0";}mon = Integer.parseInt(a);mon = mon + mo;//账户余额叠加session.setAttribute("a", mon);%><br> <br> <span style="font-size: 20px">账户余额:<%=mon%></span><br><br><span style="font-size: 20px"><a href="shop.jsp" name="g">继续购物</a></span><br><br><span style="font-size: 20px"><a href="buy.jsp" name="f">返回购物车</a></a></span></form>
</body>
</html>

order.jsp(订单界面)

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@page import="test5.product" import="java.util.*" import="java.sql.*"%>
<%@page import="test5.Product_clo" import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>我的订单</title>
<style>
table {margin: 0 auto;width: 300px;border: 1px solid red;border-collapse: collapse;
}th, td {text-align: center;border: 1px solid green;
}
</style>
</head>
<body><jsp:useBean id="db" scope="application"class="test5.DataBaseConnection"></jsp:useBean><%!int total;%><%//获取订单生成的时间Date date = new Date();SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String dd = format.format(date);session.setAttribute("payDate", dd);String d = (String) session.getAttribute("payDate");%><table style="width: 600px; background-color: #FFCCCC"><tr><td colspan="4"><%=d%>您的订单如下:</td></tr><tr><td>商品名称</td><td>商品单价</td><td>购买数量</td><td>商品价格</td></tr><%//取商品信息值String name = null;ResultSet rs = null;Connection conn = null;PreparedStatement stmt = null;conn = db.getConnection();//String sql="insert into shop.order select * from shop.shopcart;";String sql = "insert into shop.order(product_id,product_name,product_price,product_num,product_total) select product_id,product_name,product_price,cart_product_quantity,totalprice from shop.shopcart;";stmt = conn.prepareStatement(sql);stmt.executeUpdate();//String name = null;sql = "select * from shop.order;";stmt = conn.prepareStatement(sql);rs = stmt.executeQuery();int price = 0;int num = 0;int totalprice = 0;int id = 0;int pronum=0;%><%while (rs.next()) {//显示在购物车里到商品信息id=rs.getInt("product_id");name = rs.getString("product_name");price = rs.getInt("product_price");num = rs.getInt("product_num");totalprice = rs.getInt("product_total");//商品表的库存也要更新sql = "select product_quantity from shop.product where product_id="+id;stmt = conn.prepareStatement(sql);rs=stmt.executeQuery(sql);while(rs.next()){pronum=rs.getInt(1);}sql = "update shop.product set product_quantity = ?  where product_id=?;";stmt = conn.prepareStatement(sql);stmt.setInt(1, pronum-num);stmt.setInt(2, id);stmt.executeUpdate();%><tr><td style="width: 200px;"><%=name%></td><td style="width: 200px;"><%=price%></td><td style="width: 200px;"><%=num%></td><td style="width: 200px;"><%=totalprice%></td></tr><%}%><tr><td colspan="4">总价?:<%=session.getAttribute("total")%>元</td></tr></table><%//加入订单表我的购物车表自然要清空了sql = "delete from shop.shopcart";stmt = conn.prepareStatement(sql);stmt.executeUpdate();stmt.close();//关闭数据库连接conn.close();%><div align="center"><a href="shop.jsp">继续购物</a></div>
</body>
</html>

left.jsp(左侧页面)

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>导航栏</title>
<style type="text/css">
body {background-color: #FFCCCC;
}
.footer{
position:fixed;
bottom:10px;
}
</style>
<base target="_parent"/>
</head>
<body>
<div><h2>主题市场</h2><ul class="nav-hd "><li><a href="#">服装</a></li><br><li><a href="#">香水</a></li><br><li><a href="#">口红</a></li><br></ul></div>
<div class="footer">
账户余额:
<%
int mon;
if (session.getAttribute("a") == null) {mon=0;
} else {mon = (Integer) session.getAttribute("a");
} %>
<%=mon%>元
<br>
<br>
<a href = "money.jsp" target="_parent">账户充值</a><br><br>
<a href="shopcart.jsp">查看购物车</a><br><br>
<a href="buy.jsp?op=clear">清空购物车</a>
</div>
</body>
</html>

top.jsp 

<%@ 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 type="text/css">
body {background-color: #FFCCCC;
}
</style>
</head>
<body>尊敬的用户 <%-- <%= session.getAttribute("username")%> --%>欢迎您!<h1 align="center">在线购物</h1><form action="Search.jsp"><div align="center"><input type="text" style="width: 500px; height: 25px" /> <inputtype="submit" onclick="Search.jsp" value="搜索" /></div></form>
</body>
</html>

实验五 实现购物车功能(jsp+javabean+jdbc+mysql数据库)相关推荐

  1. javabean连接mysql数据库,jsp+javabean 链接 mysql 数据库

    JSP+JavaBean html 一.JavaBean类java 首先先澄清  这个三个都是绝对路径 没有相对路径, E://test.txt 和 E:/test.txt 是一个意思  E:\\te ...

  2. servlet+javabean+jdbc+mysql基于MVC模式的课件管理系统,有三个表的增删改查和课件搜索、课件上传、课件下载功能, 具体功能请看界面上的导航条

    源码支持在idea.eclipse.myeclipse运行,数据库采用MySQL数据库,项目采用mvc设计模式开发,页面采用jsp+html+css+js完成. servlet+javabean+jd ...

  3. java查询mysql装载bean_jsp与javabean链接mysql数据库并查询数据表的简单实例源码

    jsp与javabean链接mysql数据库并查询数据表的简单实例源码.这个简单的实例是给新手学习的,或者一些高手临时忘记怎么使用jsp操作mysql数据库时候查找的,包括了建立mysql数据库连接的 ...

  4. 服务器端JSP页面连接MySQL数据库的学习

    本地搭建JSP与MySQL的连接想必能看到这篇文章的人都会了,我就不再累述. 初学者码农,网上淘宝买的JSP空间,1元每月,速度稍慢,但还算稳定.本地写好简单的连接数据库的代码,上传上去还算简单,把J ...

  5. jsp连接修改MySQL数据库

    jsp连接修改MySQL数据库 创建一个jsp文件,定义一个表单 <body> <form action="messagesave.jsp" method=&qu ...

  6. 图示管理系统(还书、续借、预约功能)jsp+JavaBean+JDBC+servlet+Dao

    先在MySql中建一个数据库其中包含三个表,一个book表,一个user表,一个info表 jsp界面只输入图书号,按图书号还书,续借,预约 JavaBean中写了book类,info类,user类, ...

  7. jsp+Servlet+JavaBean+JDBC+MySQL项目增删改查

    1简单的Mvc,分层建包. java resources src/mian/java (1)dao 包 JDBC连接类,连接数据库.增删改查方法,其他的方法. (2)model包 实体类,数据库字段, ...

  8. java链接mysql mvc_MVC jsp+servlet+javabean 连接Mysql数据库測试demo

    首先我们应该了解什么是MVC: MVC包含三个部分 : ①View:由各种JSP页面组成. ②Controller:由各种Servlet组成,Controller就是将View和Model来进行匹配, ...

  9. Java Web 文章管理系统(Jsp+Ajax+JDBC+MySql实现)

    本示例是使用JavaWeb技术实现一个简单的文章管理系统(新闻管理系统)其中主要功能如下: 用户和管理员登录 用户发布新文章.文章详情查看.文章修改.文章删除与恢复 用户查看他人对自己授权的文章及其文 ...

最新文章

  1. webpack+vue实践
  2. sqlserver 把两个sql查询语句查询出来的两张表合并成一张表
  3. cache老化时间的思考--以nat为例
  4. DPDK — PMD,DPDK 的核心优化
  5. Android之给控件添加水纹波效果
  6. 5120v2怎么配置web登陆_阿里企业邮箱如何配置和添加到第三个电子邮件客户端中?...
  7. xss 全编码两次_URL编码与XSS
  8. 何时适合进行自动化测试?(上)
  9. 【转】如何有效地记忆与学习
  10. Directx工具修复工具,专注修复C++动态链接DLL文件
  11. MTT预实验与免疫染色准备
  12. 互联网时代架构师的职责与思考
  13. iic上拉电阻的阻值计算方法与特性
  14. 衣带渐宽终不悔,为UI消得人憔悴
  15. 防止服务器被修改,教您如何防止IE被恶意修改
  16. gromacs ngmx_gromacs示例
  17. 智能优化及其应用——课程实验(粒子群算法)
  18. https://mp.weixin.qq.com/s/_ZxzEo1HfyM4DH-rLKcgIg? 电容(2)之旁路电容
  19. android sd卡名称,Android系统中SD卡各文件夹名称及功能详解
  20. KPI与360度考核结合的应用落地方案

热门文章

  1. UEFI源码解析之PROTOCOLHANDLE
  2. UEFI中的Protocol浅谈
  3. MeAndMyGirfrend靶机
  4. Bootstrap_02_全局CSS之排版、代码、表格
  5. 关于G1回收器的区域分类的正确说明:自由分区说明
  6. 当数据库遇到分布式,你会怎么做?
  7. 反思 | Android 音视频缓存机制的系统性设计
  8. eclipse中tomcat简单配置
  9. 4G LTE模块通过树莓派的IO进行复位操作的演示
  10. 在简历上写了“精通”后,拥有工作经验的我被面试官问到窒息