jsp&Servlet-单表信息操作

jsp页面table表格超方便的(仿.net)编辑操作(js控制) jsp页面table表格超方便的(仿)编辑操作(js控制).rar可以很方便的让table表格有普通只读状态转入编辑状态。很爽的。 立即下载

1.建立数据库中的book表

2.将book表中的属性封装在model文件夹下

package com.oracle.book.model;

import java.io.Serializable;
import java.util.Date;

@SuppressWarnings("serial")
public class Book  implements Serializable{
	private int bookid;
	private String bookname;
	private double bookprice;
	private String publishdate;//数据库是date则java类中也是 java,util.date
	private String bookauthor;
	private String bookpublisher;
	private String bookinfo;
	private String booktype;
	private String salelocation;
	public int getBookid() {
		return bookid;
	}
	public void setBookid(int bookid) {
		this.bookid = bookid;
	}
	public String getBookname() {
		if(bookname==null){
			return "无";
		}
		return bookname;
	}
	public void setBookname(String bookname) {
		this.bookname = bookname;
	}
	public double getBookprice() {
		return bookprice;
	}
	public void setBookprice(double bookprice) {
		this.bookprice = bookprice;
	}
	public String getPublishdate() {
		return publishdate;
	}
	public String getPublishdatetoString() {
		if(publishdate==null){
			return "无";
		}
		return publishdate.toString();
	}
	public void setPublishdate(String publishdate) {
		this.publishdate = publishdate;
	}
	public String getBookauthor() {
		if(bookauthor==null){
			return "无";
		}
		return bookauthor;
	}
	public void setBookauthor(String bookauthor) {
		this.bookauthor = bookauthor;
	}
	public String getBookpublisher() {
		if(bookauthor==null){
			return "无";
		}
		return bookpublisher;
	}
	public void setBookpublisher(String bookpublisher) {
		this.bookpublisher = bookpublisher;
	}
	public String getBookinfo() {
		if(bookinfo==null){
			return "无";
		}
		return bookinfo;
	}
	public void setBookinfo(String bookinfo) {
		this.bookinfo = bookinfo;
	}
	public String getBooktype() {
		if(booktype==null){
			return "无";
		}
		return booktype;
	}
	public void setBooktype(String booktype) {
		this.booktype = booktype;
	}
	public String getSalelocation() {
		if(salelocation==null){
			return "无";
		}
		return salelocation;
	}
	public void setSalelocation(String salelocation) {
		this.salelocation = salelocation;
	}
}

3.编写JDBCTemplate放在util文件夹下

package com.oracle.book.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class JDBCTemplate {

	private Connection conn = null;

	private PreparedStatement ps = null;

	private ResultSet rs = null;

	// 静态块 ---类加载时执行
	static {
		// 加载驱动
		try {
			Class.forName("org.gjt.mm.mysql.Driver").newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

	}

	public JDBCTemplate() {
		super();
		// 加载驱动

	}

	// 获取连接
	private void getConnection() {
		try {
			conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/book", "root", "oracle");
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	// 创建ps对象
	private void createPreparedStatement(String sql) {
		this.getConnection();

		try {
			ps = conn.prepareStatement(sql);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 执行查询的方法
	 * 
	 * @param sql
	 *            可带?号的查询sql语句
	 * @param args
	 *            给?号赋值数组
	 * @return rs对象
	 */
	public ResultSet executeQuery(String sql, String[] args) {

		this.createPreparedStatement(sql);

		try {
			// 给?号赋值
			for (int i = 0; args != null && i < args.length; i++) {
				ps.setString(i + 1, args[i]);
			}
			// 执行查询方法
			rs = ps.executeQuery();

		} catch (Exception e) {
			e.printStackTrace();
		}
		return rs;

	}

	/**
	 * 执行增删改的方法
	 * 
	 * @param sql
	 *            可带?号的增删改的sql语句
	 * @param args
	 *            给?号赋值数组
	 * @return 影响的行数
	 */
	public int executeUpdate(String sql, String[] args) {

		int rowCount = -1;

		this.createPreparedStatement(sql);

		try {
			// 给?号赋值
			for (int i = 0; args != null && i < args.length; i++) {
				ps.setString(i + 1, args[i]);
			}
			// 执行查询方法
			rowCount = ps.executeUpdate();

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			this.closeResource();
		}

		return rowCount;

	}

	/**
	 * 获取首行首列的值
	 * 
	 * @param sql 
	 * @return
	 */
	public String executeScalar(String sql) {

		String res = "";
		this.createPreparedStatement(sql);

		try {
			ResultSet rs = ps.executeQuery();

			if (rs.next()) {
				res = rs.getString(1);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			this.closeResource();
		}
		return res;
	}

	/**
	 * 关闭资源
	 */
	public void closeResource() {

		try {
			if (rs != null) {
				rs.close();
				rs = null;
			}
			if (ps != null) {
				ps.close();
				ps = null;
			}
			if (conn != null) {
				conn.close();
				conn = null;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}

4.编写BookDAO放在dao文件夹下

package com.oracle.book.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.oracle.book.model.Book;
/*
 * 查找所有的书本信息
 */
public class BookDAO  extends BaseDAO{
	public List<Book> finAll(int currentpage){
		List<Book> list=new ArrayList<Book>();
		String sql="select * from book limit "+(currentpage-1)*2+",2";
		ResultSet rs=this.getJDBC().executeQuery(sql, null);
		try {
			while(rs.next()){
				Book book=new Book();
				book.setBookid(rs.getInt(1));
				book.setBookname(rs.getString(2));
				book.setBookprice(rs.getDouble(3));
				book.setPublishdate(rs.getString(4));
				book.setBookauthor(rs.getString(5));
				book.setBookpublisher(rs.getString(6));
				book.setBookinfo(rs.getString(7));
				book.setBooktype(rs.getString(8));
				book.setSalelocation(rs.getString(9));
				list.add(book);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			this.closeResource();
		}
		return list;
	}
	/*
	 * 根据bookid查询书本
	 */
	public Book findById(String bookid){
		Book book=null;
		String sql="select * from book where bookid="+bookid;
		ResultSet rs=this.getJDBC().executeQuery(sql, null);
		try {
			if(rs.next()){
				book=new Book();
				book.setBookid(rs.getInt(1));
				book.setBookname(rs.getString(2));
				book.setBookprice(rs.getDouble(3));
				book.setPublishdate(rs.getString(4));
				book.setBookauthor(rs.getString(5));
				book.setBookpublisher(rs.getString(6));
				book.setBookinfo(rs.getString(7));
				book.setBooktype(rs.getString(8));
				book.setSalelocation(rs.getString(9));
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			this.closeResource();
		}
		return book;
	}
	public int findcount(){
		String sql="select count(*) from book";
		return Integer.parseInt(this.getJDBC().executeScalar(sql));
	}
	/* 
	 * 增加书本
	 */
	public int doAdd(Book book){
		String sql="insert into book values(null,?,?,?,?,?,?,?,?);";
		return this.getJDBC().executeUpdate(sql, new String[]{book.getBookname(),book.getBookprice()+"",book.getPublishdatetoString(),book.getBookauthor(),book.getBookpublisher(),book.getBookinfo(),book.getBooktype(),book.getSalelocation()});
	}
	/*
	 * 修改书本信息
	 */
	public int doupdate(Book book,String bookid){
		String sql="update book set bookname=?,bookprice=?,publishdate=?,bookauthor=?,bookpublisher=?,bookinfo=?,booktype=?,salelocation=? where bookid="+bookid;
		System.out.println(sql);
		return this.getJDBC().executeUpdate(sql, new String[]{book.getBookname(),book.getBookprice()+"",book.getPublishdatetoString(),book.getBookauthor(),book.getBookpublisher(),book.getBookinfo(),book.getBooktype(),book.getSalelocation()});
	}
	/*
	 * 删除书本
	 */
	public int dodelete(String bookid){
		String sql="delete from book where bookid="+bookid;
		return this.getJDBC().executeUpdate(sql, null);				
	}
}
5.设计添加书本页面(index.jsp)

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>Bootstrap 基础 Template</title>
    <!-- Bootstrap -->
    <link href="bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-2.1.0.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="bootstrap/3.3.4/js/bootstrap.min.js"></script>
    
	<body>
		
	<div class="container">	
		
		<div class="jumbotron">
			<h2>当当网图书管理</h2>   
			<div> <%=request.getParameter("msg")==null?"":request.getParameter("msg")%> </div>
		</div>
		
		<div class="row">
			<div class="col-sm-4">
				<a href="index.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="添加图书" /></a>
				<a href="deletebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="删除图书" /></a>
				<a href="updatebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="修改图书" /></a>
				<a href="allbook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="查询图书" /></a>
			</div>
			<div class="col-sm-8">
				<!-- get和post是有区别的。
					什么区别:
						两点:1/get是以 ?  & 符号的形式将参数附加到地址中,提交。【数据是在请求头】
							 	get最多可以提交 255字符。2kb.. get方式的乱码,程序是不好解决的,需要
							 	修改容器【服务器】
							 2/post是提交的数据量理论上没有限制。文件上传必须用post
						
				 -->
				<form method="post" action="AddBook">
					<table class="table table-bordered table-striped">
						<tr>
							<td>图书名称</td>
							<td><input name="bname" class="form-control" type="text" /></td>
						</tr>
						<tr>
							<td>售价</td>
							<td><input name="bprice"  class="form-control" type="text" /></td>
						</tr>
						<tr>
							<td>出版时间</td>
							<td><input name="bpubdate" class="form-control" type="text" /></td>
						</tr>
						<tr>
							<td>作者</td>
							<td><input name="bauthor" class="form-control" type="text" /></td>
						</tr>
						<tr>
							<td>出版社</td>
							<td><input name="bpublisher"  class="form-control" type="text" /></td>
						</tr>
						<tr>
							<td>备注</td>
							<td><input name="binfo" class="form-control" type="text" /></td>
						</tr>
						<tr>
							<td>类别</td>
							<td><input name="btype" class="form-control" type="text" /></td>
						</tr>
						<tr>
							<td>销售区域</td>
							<td>
								<input name="bsaleloc" type="checkbox" value="hd">华东
								<input name="bsaleloc" type="checkbox" value="hb">华北
								<input name="bsaleloc" type="checkbox" value="hn">华南
								<input name="bsaleloc" type="checkbox" value="hz">华中
								<input name="bsaleloc" type="checkbox" value="hz">全国	
							</td>
						</tr>
						<tr>
							<td align="center" colspan="2">
								<input  class=" btn btn-block btn-danger btn-lg" type="submit" value="添加"> 
							</td>
						</tr>
					</table>
				</form>
				
			</div>
		</div>
		
	</div>
		
	</body>
</html>

6.设计删除书本页面(deletebook.jsp)

<%@page import="com.oracle.book.dao.BookDAO"%>
<%@page import="com.oracle.book.model.Book"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>Bootstrap 基础 Template</title>
    <!-- Bootstrap -->
    <link href="bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-2.1.0.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="bootstrap/3.3.4/js/bootstrap.min.js"></script>
    
    <%
    	//分页
    	int currentpage=1;
    	BookDAO bookdao=new BookDAO();
    	if(request.getParameter("currentpage")!=null){
    		currentpage=Integer.parseInt(request.getParameter("currentpage"));
    	}
    	//分页标准
    	int pagenorm=2;
    	//总记录数
    	int allrow=bookdao.findcount();
    	//总页数
    	int allpage=allrow % pagenorm>0?allrow/pagenorm+1:allrow/pagenorm;
    	//处理分页
    	if(allpage!=0&¤tpage>allpage){
    		currentpage=allpage;
    	}
    	if(currentpage<=1){
    		currentpage=1;
    	}
    	List<Book> books=bookdao.finAll(currentpage);
     %>
	<body>
		
	<div class="container">	
		
		<div class="jumbotron">
			<h2>当当网图书管理</h2>   
			<div> <%=request.getParameter("msg")==null?"":request.getParameter("msg")%> </div>
		</div>
		
		<div class="row">
			<div class="col-sm-4">
				<a href="index.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="添加图书" /></a>
				<a href="deletebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="删除图书" /></a>
				<a href="updatebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="修改图书" /></a>
				<a href="allbook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="查询图书" /></a>
			</div>
			<div class="col-sm-8">
				 <form action="DeleteBook" method="post">
					<table class="table table-bordered table-striped">
						<tr>
							<th>删除</th>
							<th>图书名称</th>
							<th>售价</th>
							<th>出版时间</th>
							<th>作者</th>
							<th>出版社</th>
							<th>备注</th>
							<th>类别</th>
							<th>销售区域</th>
						</tr>
						<%
							for(Book book:books){
							
						%>
						<tr>
							<td><input type="checkbox" name="bookid" value="<%=book.getBookid()%>"/></td>
							<td><input name="bname" class="form-control" type="text" value="<%=book.getBookname()%>"/></td>
							<td><input name="bprice"  class="form-control" type="text" value="<%=book.getBookprice()%>" /></td>
							<td><input name="bpubdate" class="form-control" type="text" value="<%=book.getPublishdatetoString()%>"/></td>
							<td><input name="bauthor" class="form-control" type="text" value="<%=book.getBookauthor()%>"/></td>
							<td><input name="bpublisher"  class="form-control" type="text" value="<%=book.getBookpublisher()%>"/></td>
							<td><input name="binfo" class="form-control" type="text" value="<%=book.getBookinfo()%>"/></td>
							<td><input name="btype" class="form-control" type="text" value="<%=book.getBooktype()%>"/></td>
							<td><input name="bsaleloc" class="form-control" type="text" value="<%=book.getSalelocation()%>"/></td>
						</tr>
						<% }%>
						<tr>
							<td align="center" colspan="9">
								<a href="deletebook.jsp?currentpage=<%=currentpage-1%>">上一页</a>
								<a href="deletebook.jsp?currentpage=<%=currentpage+1%>">下一页</a>
							</td>
						</tr>
						<tr>
							<td align="center" colspan="9">
								<input  class=" btn btn-block btn-danger btn-lg" type="submit" value="删除"> 
							</td>
						</tr>							
					</table>
				</form>
			</div>
		</div>
		
	</div>
	</body>
</html>

7.设计修改书本页面(updatebook.jsp)

<%@page import="com.oracle.book.dao.BookDAO"%>
<%@page import="com.oracle.book.model.Book"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>Bootstrap 基础 Template</title>
    <!-- Bootstrap -->
    <link href="bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-2.1.0.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="bootstrap/3.3.4/js/bootstrap.min.js"></script>
    
    <%
    	//分页
    	int currentpage=1;
    	BookDAO bookdao=new BookDAO();
    	if(request.getParameter("currentpage")!=null){
    		currentpage=Integer.parseInt(request.getParameter("currentpage"));
    	}
    	//分页标准
    	int pagenorm=2;
    	//总记录数
    	int allrow=bookdao.findcount();
    	//总页数
    	int allpage=allrow % pagenorm>0?allrow/pagenorm+1:allrow/pagenorm;
    	//处理分页
    	if(allpage!=0&¤tpage>allpage){
    		currentpage=allpage;
    	}
    	if(currentpage<=1){
    		currentpage=1;
    	}
    	List<Book> books=bookdao.finAll(currentpage);
     %>
	<body>
		
	<div class="container">	
		
		<div class="jumbotron">
			<h2>当当网图书管理</h2>   
			<div> <%=request.getParameter("msg")==null?"":request.getParameter("msg")%> </div>
		</div>
		
		<div class="row">
			<div class="col-sm-4">
				<a href="index.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="添加图书" /></a>
				<a href="deletebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="删除图书" /></a>
				<a href="updatebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="修改图书" /></a>
				<a href="allbook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="查询图书" /></a>
			</div>
			<div class="col-sm-8">
				 <form action="doupdate.jsp" method="post">
					<table class="table table-bordered table-striped">
						<tr>
							<th>修改</th>
							<th>图书名称</th>
							<th>售价</th>
							<th>出版时间</th>
							<th>作者</th>
							<th>出版社</th>
							<th>备注</th>
							<th>类别</th>
							<th>销售区域</th>
						</tr>
						<%
							for(Book book:books){
							
						%>
						<tr>
							<td><input type="checkbox" name="bookid" value="<%=book.getBookid()%>"/></td>
							<td><input name="bname" class="form-control" type="text" value="<%=book.getBookname()%>"/></td>
							<td><input name="bprice"  class="form-control" type="text" value="<%=book.getBookprice()%>" /></td>
							<td><input name="bpubdate" class="form-control" type="text" value="<%=book.getPublishdatetoString()%>"/></td>
							<td><input name="bauthor" class="form-control" type="text" value="<%=book.getBookauthor()%>"/></td>
							<td><input name="bpublisher"  class="form-control" type="text" value="<%=book.getBookpublisher()%>"/></td>
							<td><input name="binfo" class="form-control" type="text" value="<%=book.getBookinfo()%>"/></td>
							<td><input name="btype" class="form-control" type="text" value="<%=book.getBooktype()%>"/></td>
							<td><input name="bsaleloc" class="form-control" type="text" value="<%=book.getSalelocation()%>"/></td>
						</tr>
						<% }%>
						<tr>
							<td align="center" colspan="9">
								<a href="updatebook.jsp?currentpage=<%=currentpage-1%>">上一页</a>
								<a href="updatebook.jsp?currentpage=<%=currentpage+1%>">下一页</a>
							</td>
						</tr>
						<tr>
							<td align="center" colspan="9">
								<input  class=" btn btn-block btn-danger btn-lg" type="submit" value="修改"> 
							</td>
						</tr>						
					</table>
				</form>
			</div>
		</div>
		
	</div>
	</body>
</html>

8.设计修改书本页面(doupdate.jsp)

<%@page import="com.oracle.book.model.Book"%>
<%@page import="com.oracle.book.dao.BookDAO"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>Bootstrap 基础 Template</title>
    <!-- Bootstrap -->
    <link href="bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-2.1.0.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="bootstrap/3.3.4/js/bootstrap.min.js"></script>
    
	<body>
	<%
		BookDAO bookdao=new BookDAO();
		//获取提交信息
		String bookid=request.getParameter("bookid");
		Book book=bookdao.findById(bookid);
	 %>	
	<div class="container">	
		
		<div class="jumbotron">
			<h2>当当网图书管理</h2>   
			<div> <%=request.getParameter("msg")==null?"":request.getParameter("msg")%> </div>
		</div>
		
		<div class="row">
			<div class="col-sm-4">
				<a href="index.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="添加图书" /></a>
				<a href="deletebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="删除图书" /></a>
				<a href="updatebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="修改图书" /></a>
				<a href="allbook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="查询图书" /></a>
			</div>
			<div class="col-sm-8">
				<form method="post" action="UpdateBook">
					<input type="hidden" name="bookid" value="<%=bookid%>"/> 
					<table class="table table-bordered table-striped">
						<tr>
							<td>图书名称</td>
							<td><input name="bname" class="form-control" type="text" value="<%=book.getBookname()%>"/></td>
						</tr>
						<tr>
							<td>售价</td>		
							<td><input name="bprice"  class="form-control" type="text" value="<%=book.getBookprice()%>" /></td>
						</tr>
						<tr>
							<td>出版时间</td>
							<td><input name="bpubdate" class="form-control" type="text" value="<%=book.getPublishdatetoString()%>"/></td>
						</tr>
						<tr>
							<td>作者</td>
							<td><input name="bauthor" class="form-control" type="text" value="<%=book.getBookauthor()%>"/></td>
						</tr>
						<tr>
							<td>出版社</td>
							<td><input name="bpublisher"  class="form-control" type="text" value="<%=book.getBookpublisher()%>"/></td>
						</tr>
						<tr>
							<td>备注</td>
							<td><input name="binfo" class="form-control" type="text" value="<%=book.getBookinfo()%>"/></td>
						</tr>
						<tr>
							<td>类别</td>
							<td><input name="btype" class="form-control" type="text" value="<%=book.getBooktype()%>"/></td>
						<tr>
							<td>销售区域</td>
							<td><input name="bsaleloc" class="form-control" type="text" value="<%=book.getSalelocation()%>"/></td>
						</tr>
						<tr>
							<td align="center" colspan="2">
								<input  class=" btn btn-block btn-danger btn-lg" type="submit" value="修改"> 
							</td>
						</tr>
					</table>
				</form>
				
			</div>
		</div>
		
	</div>
		
	</body>
</html>
</html>

9.设计查询书本页面(allbook.jsp)

<%@page import="com.oracle.book.model.Book"%>
<%@page import="com.oracle.book.dao.BookDAO"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>Bootstrap 基础 Template</title>
    <!-- Bootstrap -->
    <link href="bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-2.1.0.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="bootstrap/3.3.4/js/bootstrap.min.js"></script>
    
    <%
    	//分页
    	int currentpage=1;
    	BookDAO bookdao=new BookDAO();
    	if(request.getParameter("currentpage")!=null){
    		currentpage=Integer.parseInt(request.getParameter("currentpage"));
    	}
    	//分页标准
    	int pagenorm=2;
    	//总记录数
    	int allrow=bookdao.findcount();
    	//总页数
    	int allpage=allrow % pagenorm>0?allrow/pagenorm+1:allrow/pagenorm;
    	//处理分页
    	if(allpage!=0&¤tpage>allpage){
    		currentpage=allpage;
    	}
    	if(currentpage<=1){
    		currentpage=1;
    	}
    	List<Book> books=bookdao.finAll(currentpage);
     %>
	<body>
		
	<div class="container">	
		
		<div class="jumbotron">
			<h2>当当网图书管理</h2>   
			<div> <%=request.getParameter("msg")==null?"":request.getParameter("msg")%> </div>
		</div>
		
		<div class="row">
			<div class="col-sm-4">
				<a href="index.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="添加图书" /></a>
				<a href="deletebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="删除图书" /></a>
				<a href="updatebook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="修改图书" /></a>
				<a href="allbook.jsp"><input type="button" class="btn btn-lg btn-block btn-success" value="查询图书" /></a>
			</div>
			<div class="col-sm-8">
				<!-- get和post是有区别的。
					什么区别:
						两点:1/get是以 ?  & 符号的形式将参数附加到地址中,提交。【数据是在请求头】
							 	get最多可以提交 255字符。2kb.. get方式的乱码,程序是不好解决的,需要
							 	修改容器【服务器】
							 2/post是提交的数据量理论上没有限制。文件上传必须用post
						
				 -->
					<table class="table table-bordered table-striped">
						<tr>
							<th>图书名称</th>
							<th>售价</th>
							<th>出版时间</th>
							<th>作者</th>
							<th>出版社</th>
							<th>备注</th>
							<th>类别</th>
							<th>销售区域</th>
						</tr>
						<%
							for(Book book:books){
							
						%>
						<tr>
							<td><input name="bname" class="form-control" type="text" value="<%=book.getBookname()%>"/></td>
							<td><input name="bprice"  class="form-control" type="text" value="<%=book.getBookprice()%>" /></td>
							<td><input name="bpubdate" class="form-control" type="text" value="<%=book.getPublishdatetoString()%>"/></td>
							<td><input name="bauthor" class="form-control" type="text" value="<%=book.getBookauthor()%>"/></td>
							<td><input name="bpublisher"  class="form-control" type="text" value="<%=book.getBookpublisher()%>"/></td>
							<td><input name="binfo" class="form-control" type="text" value="<%=book.getBookinfo()%>"/></td>
							<td><input name="btype" class="form-control" type="text" value="<%=book.getBooktype()%>"/></td>
							<td><input name="bsaleloc" class="form-control" type="text" value="<%=book.getSalelocation()%>"/></td>
						</tr>
						<% }%>
						<tr>
						<td align="center" colspan="8">
						<a href="allbook.jsp?currentpage=<%=currentpage-1%>">上一页</a>
						<a href="allbook.jsp?currentpage=<%=currentpage+1%>">下一页</a>
						</td>
						</tr>						
					</table>
			</div>
		</div>
		
	</div>
		
	</body>
</html>
10.设计处理添加、删除、修改的Servlet类AddServlet、DeleteServlet、UpdateServlet类放在servlet文件夹下

package com.oracle.book.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.oracle.book.dao.BookDAO;
import com.oracle.book.model.Book;

public class AddServlet extends HttpServlet {
	public AddServlet() {
		super();
	}
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 设置服务器编码格式
		request.setCharacterEncoding("utf-8");
		// 设置浏览器编码格式
		response.setCharacterEncoding("utf-8");
		// 告诉浏览器所用的文档类型和编码格式
		response.setContentType("text/html;charset=utf-8");
		// 获取数据
		String bookname = request.getParameter("bname");
		double bookprice = Double.parseDouble(request.getParameter("bprice"));
		String bookauthor = request.getParameter("bauthor");
		String bookpublisher = request.getParameter("bpublisher");
		String[] str = request.getParameterValues("bsaleloc");
		String salelocation = "";
		for (int i = 0; i < str.length; i++) {
			if(str[i].equals(str[str.length-1])){
				if (str[i].equals("hz")) {
					salelocation += "华中";
				} else if (str[i].equals("hd")) {
					salelocation += "华东";
				} else if (str[i].equals("hb")) {
					salelocation += "华北";
				} else if (str[i].equals("hn")) {
					salelocation += "华南";
				} else if (str[i].equals("all")) {
					salelocation += "全国";
				}
			}else{
				if (str[i].equals("hz")) {
					salelocation += "华中,";
				} else if (str[i].equals("hd")) {
					salelocation += "华东,";
				} else if (str[i].equals("hb")) {
					salelocation += "华北,";
				} else if (str[i].equals("hn")) {
					salelocation += "华南,";
				} else if (str[i].equals("all")) {
					salelocation += "全国";
				}
			}
		}
		String publishdate = request.getParameter("bpubdate");
		System.out.println(publishdate);
		String bookinfo = request.getParameter("binfo");
		String booktype = request.getParameter("btype");
		Book book = new Book();
		book.setBookname(bookname);
		book.setBookprice(bookprice);

		// string转换为date java
		SimpleDateFormat smf = new SimpleDateFormat("yyyy-MM-dd");
		Date d=null;
		try {
			d = smf.parse(publishdate);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		book.setPublishdate(publishdate); 
		book.setBookauthor(bookauthor);
		book.setBookpublisher(bookpublisher);
		book.setBookinfo(bookinfo);
		book.setBooktype(booktype);
		book.setSalelocation(salelocation);
		BookDAO bookdao = new BookDAO();
		int count = bookdao.doAdd(book);
		if (count > 0) {
			PrintWriter out = response.getWriter();
			out.write("添加成功");
			request.getRequestDispatcher("index.jsp?msg=添加成功").forward(request,
					response);
		} else {
			request.getRequestDispatcher("error.jsp?errorinfo=添加失败").forward(
					request, response);
		}
	}
	public void init() throws ServletException {
		// Put your code here
	}

}

package com.oracle.book.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.oracle.book.dao.BookDAO;

public class DeleteServlet extends HttpServlet {
	public DeleteServlet() {
		super();
	}
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
		out.println("<HTML>");
		out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
		out.println("  <BODY>");
		out.print("    This is ");
		out.print(this.getClass());
		out.println(", using the GET method");
		out.println("  </BODY>");
		out.println("</HTML>");
		out.flush();
		out.close();
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		//设置服务器编码格式
		request.setCharacterEncoding("utf-8");
		//设置浏览器编码格式
		response.setCharacterEncoding("utf-8");
		//告诉浏览器所用的文档类型和编码格式
		response.setContentType("text/html;charset=utf-8");
		//获取数据
		String bookid=request.getParameter("bookid");
		BookDAO bookdao=new BookDAO();
		int count=bookdao.dodelete(bookid);
		if(count>0){
			PrintWriter out=response.getWriter();
			out.write("修改成功");
			request.getRequestDispatcher("deletebook.jsp?msg=删除成功").forward(request, response);
		}else{
			request.getRequestDispatcher("error.jsp?errorinfo=删除失败").forward(request, response);
		}
	}
	public void init() throws ServletException {
		// Put your code here
	}

}

package com.oracle.book.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.oracle.book.dao.BookDAO;
import com.oracle.book.model.Book;


public class UpdateServlet extends HttpServlet {
	public UpdateServlet() {
		super();
	}

	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}


	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
		out.println("<HTML>");
		out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
		out.println("  <BODY>");
		out.print("    This is ");
		out.print(this.getClass());
		out.println(", using the GET method");
		out.println("  </BODY>");
		out.println("</HTML>");
		out.flush();
		out.close();
	}


	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		//设置服务器编码格式
		request.setCharacterEncoding("utf-8");
		//设置浏览器编码格式
		response.setCharacterEncoding("utf-8");
		//告诉浏览器所用的文档类型和编码格式
		response.setContentType("text/html;charset=utf-8");
		//获取数据
		String bookid=request.getParameter("bookid");
		String bookname=request.getParameter("bname");
		double bookprice=Double.parseDouble(request.getParameter("bprice"));
		String bookauthor=request.getParameter("bauthor");
		String bookpublisher=request.getParameter("bpublisher");
		String salelocation=request.getParameter("bsaleloc");
		String publishdate=request.getParameter("bpubdate");
		String bookinfo=request.getParameter("binfo");
		String booktype=request.getParameter("btype");
		Book book=new Book();
		book.setBookname(bookname);
		book.setBookprice(bookprice);
		book.setPublishdate("2010-12-12");
		book.setBookauthor(bookauthor);
		book.setBookpublisher(bookpublisher);
		book.setBookinfo(bookinfo);
		book.setBooktype(booktype);
		book.setSalelocation(salelocation);
		BookDAO bookdao=new BookDAO();
		int count=bookdao.doupdate(book,bookid);
		if(count>0){
			PrintWriter out=response.getWriter();
			out.write("修改成功");
			request.getRequestDispatcher("updatebook.jsp?msg=修改成功").forward(request, response);
		}else{
			request.getRequestDispatcher("error.jsp?errorinfo=修改失败").forward(request, response);
		}
	}

	public void init() throws ServletException {
		// Put your code here
	}


}
页面效果预览




用servlet做的单表的增删改查 用servlet做的对单表的增删改查数据库时2008的 立即下载

相关推荐

JSP单表增删改查sql连接

JSP单表增删改查sql连接,简单的JSP代码增删改查和数据库连接

`<jsp:getProperty>`动作和`<jsp:setProperty>`动作的使用在一个静态页面填写图书的基本信息,页面信息提交给其他页面,并且在其页面显示。要去将表单元素的值赋值给Java

<jsp:getProperty>动作和<jsp:setProperty>动作的使用 1、<jsp:getProperty>动作 语法格式: <jsp:getProperty name="类的对象名" property="属性名"></jsp:getProperty> name:用于指定JavaBean实例对象的名称。其值和<jsp:useBean>标签的id属性值相同。 propery:用于指定JavaBean实例对象的属性名。 注

日常笔记 | 干货分享 | 毕设源码 | 毕设指导 | 答辩指导 1146

光流法实战:如何用OpenCV的Farneback算法实现图像对齐(附调参技巧)

本文详细介绍了如何使用OpenCV的Farneback稠密光流算法实现图像对齐,包括核心原理、参数调优和工程实现。通过实战代码和参数优化策略,帮助开发者解决动态场景中的图像对齐问题,提升多帧融合和视频处理的效果。

weixin_29266007的博客 298

jsp电子商务购物车之 数据库存储篇

为了方便用户下次登录,仍然可以看到自己的购物车内容,所以,需要在数据库存储相应的购物车项目,本处增加购物车项表;uid和bid是复合主键。package com.cart.entity; //购物车的单项; public class CartItem { int uid; int bid; //外键;理解为商品id,这样可以任意; int count; String book...

weixin_30532987的博客 483

Xiaojie雷达之路---使用CCS创建一个毫米波雷达的工程(AWR1843)

前些天,在工具箱中下载了一个基于毫米波雷达(AWR1843)自动停车的案例,并成果导入CCS中,可以完美运行,但是如何新建一个新的工程呢?这篇文章就会对其进行讲述。

XiaoJie的博客 4564

别再重启了!Win11开机卡死/间歇性卡顿的终极排查与修复指南(附免费工具)

本文提供Win11开机卡死和间歇性卡顿的终极排查与修复指南,涵盖从后台进程清理到驱动优化、系统组件修复及硬件监控的全方位解决方案。通过专业工具和详细步骤,帮助用户彻底解决Win11卡顿问题,无需重启或重装系统。

weixin_31102231的博客 789

JDBC 获取表中列信息

【开始】 现在有这么个需求, 1.知道一个表名 2.通过表名获取表中所有的列 3.知道列的

uikoo9的专栏 5791

Nordic BLE芯片RF测试

BLE设备在过蓝牙BQB,FCC,ETSI等各种认证时实验室一般都需要做RF各项指标的测试。Nordic公司的SDK包中提供了两种RF测试程序,一种是DTM,另一种是Radio test。这两种都可以做RF指标测试但各自又有区别。DTM是按照蓝牙规范中Direct test mode所要求数据格式测试(数据格式定义参看:Bluetooth Core Specification v5.0->...

5655

jdbc获取结果行数_JDBC | 查询表数据行数

两种方法:1、"select * from userinfo"利用ResultSet的last和getRow方法来获得ResultSet的总行数,适用于在查询数据的同时统计记录条数。// sql语句String sql = "select * from userinfo";Statement stmt = conn.prepareStatement(sql);// 执行SQL语句,并返回一个Re...

weixin_39765209的博客 1667

第32篇:Vibe Coding时代:LangGraph + Redis 任务状态持久化实战,解决服务重启后任务状态丢失问题

LangGraph + Redis任务状态持久化方案 本文针对Agent任务状态丢失问题,提出基于Redis的持久化解决方案。当服务重启时,传统内存存储方式会导致任务状态丢失,影响用户体验和运维排查。 核心方案 使用Redis Hash存储任务状态,key格式为agent:task:{task_id} 设计完整状态字段包括task_id、status、progress等关键信息 实现task_store模块提供CRUD操作接口 在Agent执行各节点更新Redis中的任务状态 技术实现 通过Celery执行

sundong_81的博客 49

IEC 60747-8 是由国际电工委员会(IEC)制定的标准,标题为《半导体器件 - 分立器件 - 第8部分:场效应晶体管》

IEC 60747-8 是由国际电工委员会(IEC)制定的标准,标题为《半导体器件 - 分立器件 - 第8部分:场效应晶体管》(Semiconductor devices - Discrete devices - Part 8: Field-effect transistors)。该标准详细规定了场效应晶体管(FETs)的测试方法,涵盖静态和动态特性测试,适用于多种类型的FET,包括结型场效应晶体管(JFETs)、绝缘栅场效应晶体管(MOSFETs,增强型和耗尽型)等。3. 标准其他部分(简要概述)

专注于前沿技术的探索与实践,热衷于从代码逻辑、架构设计到行业应用等多维度深挖技术本质。期待在技术之路上与你共同成长~ 608

Java图书管理系统

目录 一、总览 二、Book类 1.基本: 2.Book类方法 (1)图书信息列表显示 (2)图书信息排序(书号、书名,升序) (3)图书信息新增 (4)图书信息删除、修改 (5)图书信息查找(按书名,按作者名,按出版社查找) 三、Reader类 1.基本: 2.Reader类方法 (1)读者信息展示 (2)读者信息排序(学号、学院) (3)读...

wangzai6666的博客 4179

第244篇 视觉SLAM后端之BA优化——Bundle Adjustment的原理

本文介绍了SLAM后端优化中的Bundle Adjustment(BA)技术。BA通过同时优化相机位姿和3D路标点位置,最小化重投影误差,解决前端估计的累积误差问题。文章详细讲解了BA的数学原理,包括目标函数构建、Gauss-Newton法和Levenberg-Marquardt法求解过程,以及利用稀疏性和Schur补加速计算的关键技术。对比了全量BA和增量BA的优缺点,并介绍了Ceres、g2o等工程实现工具。BA作为SLAM后端的核心算法,其理解深度直接影响系统性能优化能力。

郑伟强dev的专栏 374

EL表达式取值与类的get方法

今天在写 JavaEE 作业的时候,出了些 bug ,最初以为是 MyBatis 的映射问题,后来发现与 EL 表达式的取值原理有关。写篇文章记录一下这个小经验。 背景 用 MyBatis 获取数据库中的书籍信息(books表),然后用 EL 表达式,将查询结果显示在 jsp 界面上。 在 books 表中,有一个 book_name 属性,在 Book 类中也有同名属性。在 jsp 中用 EL 表达式 ${book.book_name} 输出 book 对象的属性值。 问题 报错显示找不到 Book 中

m0_51864047的博客 874

Amazon SES 移出沙盒完整指南 & 高通过率模板

AWS SES沙盒模式转正式模式申请指南 申请正式模式需通过AWS审核,常见被拒原因包括邮件用途不清晰、缺少退订机制或发送量不合理。人工申诉需登录AWS Support Center提交服务限额提升请求,填写详细的公司信息、邮件用途及合规措施。 高通过率申诉模板需包含: 公司信息:名称、网址及与AWS的合作情况。 邮件规范:明确类型(交易/营销)、退订链接及退信处理机制。 发送计划:合理预估发送量,确保合规。 关键点:真实信息、用途清晰、退订机制完善、发送量合理。首次被拒可修改后重新提交。

xianyinsuifeng的博客 335

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

基于Java jsp+servlet超市订单管理平台设计和实现【建议收藏】

课题设计内容: 随着小超市规模的发展不断扩大, 商品数量急剧增加, 有关商品的各种信息量也成倍增长。 超市时时刻刻都需要对商品各种信息进行统计分析。 而大型的超市管理系统功能过于强大而造成操作繁琐降低了小超市的工作效率。 超市管理系统是市场上最流行的超市上常用的系统之一, 它主要包含以下几个模块: 系统登陆、商品入库、商品查询、商品更改和删除等。从而,实现对进货、销售及员工信息等实现全面、 动态、及时的管理。本文系统的分析了软件开发的背景以过程;首先介绍了软件的开发环境, 其次介绍了本软件的详细设计过程:

java李阳勇的博客 2万+

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Java项目:基于JSP+Servlet的网上订餐管理系统

基于JSP+Servlet的网上订餐管理系统的设计与实现。该项目为前后台管理项目。前台主要展示给普通用户,主要功能有菜品分类、最新菜品、销售排行、美食预订、营养小贴士、餐点搜索、订餐车、在线留言等;后台主要提供给管理员,主要功能有菜品管理、菜品类别管理、营养小贴士管理、会员管理、员工管理、留言管理、采购管理、销售订单查询、统计管理、用户管理等;

1431

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

展示商品列表用jsp_jsp+servlet实战编写购物商城

jsp+servlet实战编写购物商城点赞再看,养成习惯项目介绍 本项目使用jsp+servlet+mysql架构搭建美妆购物商城,主要分为用户端和商城端,用户端主要有首页展示,商品信息、购物车、订单和个人中心几个大的模块,每个模块都包含主要的电商功能;商户端主要是对商品的增删改查,对商品销量的统计,订单管理以及公告管理几个核心板块。开发环境:jdk 8intellij ideatomcat 8m...

weixin_33140809的博客 2148

Servlet小项目 | 基于纯Servlet手写一个单表的CRUD操作

Servlet小项目 | 基于纯Servlet手写一个单表的CRUD操作

m0_61933976的博客 903

基于MVC用JSP/Servlet实现JPetStore——基本任务3(订单管理模块)

基于MVC用JSP/Servlet实现JPetStore 订单管理模块,包括购物车管理、新增订单、地址信息等业务功能。 3.1 添加商品到购物车   先实现Cart.jsp,能够在网页显示购物车栏目信息,接下来具体实现Cart.java使得用户可以创建Cart类,最后创建AddItemToCartServlet,当用户在浏览商品界面时,点击Add to Cart时可以将该商品加入到购物车...

渣渣的夏天 2772

基于JAVA+Servlet+JSP+MYSQL的在线购物系统

项目功能: 前台用户:搜索商品,分类筛选商品,查看商品详情,加入购物车,提交订单,查看我的订单 后台管理:销售统计,商品列表,添加商品,分类列表,添加一级分类,添加二级分类,商品分类,用户列表,添加用户,角色列表,添加角色,用户权限列表,折扣信息,添加折扣,订单管理 页面效果: ...

qq_3306428634的博客 341

基于Jsp+Servlet的图书商城

项目类型:JAVA WEB项目(B/S架构) 项目名称:基于SSM的图书商城(可作为多种类型的商城) 用户类型:2个角色(管理员+购物者)系统类型:前端购物界面+后台管理设计模式:Jsp+Servlet 界面外观:部分的Layui+CSS+JS开发工具:Eclipse/Idea数据库:Mysql+Navicat数据库表:7张(用户表、管理员表、公告表、订单表、订单详情表、商品表、商品分类表)适用:软件工程、计算机科学与技术等 作者介绍:计科学长,定期发布高质量手工开发源码!双1流高校刚毕业的...

学长源码的博客 1866

###Jsp+Servlet购物商城day04.4:订单模块 【页面双层遍历】 显示本页所有订单。bootstrap分页下标。

订单分页显示:order_info.jsp ====关于页面显示,最容易忘记:订单,订单项双层 遍历。至于分页,分页用的PageBean封装好了,不难做。 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 订单列表页面

anyway, life must全力以赴 1225

Shop项目--12. 显示用户订单列表order_list.jsp

分析: 显示用户订单列表在order_list.jsp页面,要一个功能servlet,把数据传递给前台页面显示。同时要先判断用户是否已经登陆。关键在于数据需要怎么封装,这里涉及多表查询。 1.根据uid,查询用户的所有订单集合List。此时order对象里数据orderItem集合还没有封装好,需要遍历封装数据 2.判断List是否为空,如不为空,进行遍历,并进行多表查询。查询ord

weixin_39472341的博客 5151

jsp(8):Servlet的简单使用,处理表单信息

我们都知道有get\post两种传递表单信息的方式,其实每一次提交表单,服务器都会通过servlet去处理这些数据。可以利用这一点,自定义一个servlet,然后自己写代码根据get/post去处理相应的数据操作啦。在Java Resource的src包下创建一个包,例如myservlet包,再在这个包下右键新建一个servlet类,取名字为FirstServlet可以看到这个servlet长这样...

aic1999的博客 700

关于GetUserName的用法及参数含义

声明: Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nsize As Long) As Long 用途:获得当前用户的名称 参数的含义: lpBuffer:string型,一个字符串的缓冲区,预先初始化成有nsize指定的长度,他

littlecolor 5357
上一篇: jsp-九大内置对象
下一篇: JDBC-连接oracle和MySql数据库的基类
fightingcoder419
博客等级 码龄10年 23粉丝 77原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址