<%@ 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>
<head>
<base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head> <body>
<form action="BookServlet?op=add" method="post">
书名: <input name="bname"/><br/>
价格: <input name="price"/> <br/>
作者: <input name="author"/> <br/>
页码: <input name="pagecount"/> <br/>
<input type="submit" value="添加"/>
</form>
</body>
</html>

  

<%@ 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>
<head>
<base href="<%=basePath%>"> <title>My JSP 'update.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<form action="BookServlet?op=update" method="post">
编号: <input name="bid" value="${book.bid }" readonly="readonly"/> <br/>
书名: <input name="bname" value="${book.bname }"/><br/>
价格: <input name="price" value="${book.price }"/> <br/>
作者: <input name="author" value="${book.author }"/> <br/>
页码: <input name="pagecount" value="${book.pagecount }"/> <br/>
<input type="submit" value="提交">
</form>
</body>
</html>

  

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'showlist.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body onload="showok(${canshow},'${msg}')">
<script>
function showok(canshow,msg)
{
if(canshow)
alert(msg);
}
function confirm_delete(bid)
{
if(window.confirm("确定删除编号为"+bid+"的书吗?"))
{
window.location.href = "BookServlet?op=delete&bid="+bid;
}
}
</script>
<table border="1">
<tr>
<th>
编号
</th>
<th>
书名
</th>
<th>
价格
</th>
<th>
操作
</th>
</tr>
<c:set var="i" value="0"/>
<c:forEach items="${list}" var="book">
<c:set var="i" value="${i+1}"/>
<tr>
<td>
${book.bid }
</td>
<td>
${book.bname }
</td>
<td>
${book.price }
</td>
<td>
<a href="javascript:confirm_delete(${book.bid})">删除</a>
 
<a href="BookServlet?op=toupdate&bid=${book.bid}">修改</a>
</td>
</tr> </c:forEach> </table>
一共有${i}本书。
<br/>
<a href="add.jsp">重新录入</a>
</body>
</html>

  

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'showlist.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body onload="showok(${canshow},'${msg}')">
<script>
function showok(canshow,msg)
{
if(canshow)
alert(msg);
}
function confirm_delete(bid)
{
if(window.confirm("确定删除编号为"+bid+"的书吗?"))
{
window.location.href = "BookServlet?op=delete&bid="+bid;
}
}
</script>
<table border="1">
<tr>
<th>
编号
</th>
<th>
书名
</th>
<th>
价格
</th>
<th>
操作
</th>
</tr>
<c:set var="i" value="0"/>
<c:forEach items="${pm.list}" var="book">
<c:set var="i" value="${i+1}"/>
<tr>
<td>
${book.bid }
</td>
<td>
${book.bname }
</td>
<td>
${book.price }
</td>
<td>
<a href="javascript:confirm_delete(${book.bid})">删除</a>
 
<a href="BookServlet?op=toupdate&bid=${book.bid}">修改</a>
</td>
</tr> </c:forEach> </table>
一共有${i}本书。
<br/>
<a href="BookServlet?op=findbypage&pageno=1&pagesize=5">首页</a>
<a href="BookServlet?op=findbypage&pageno=${pm.pageno+1}&pagesize=5">下一页</a>
<a href="BookServlet?op=findbypage&pageno=${pm.pageno-1}&pagesize=5">上一页</a>
<a href="BookServlet?op=findbypage&pageno=${pm.totalpage}&pagesize=5">末页</a>
<br/>
<a href="add.jsp">重新录入</a>
</body>
</html>

  

package com.etc.model.entity;

public class Book
{
private int bid;
private String bname;
private float price;
private String author; //作者
private int pagecount; //页码 public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getPagecount() {
return pagecount;
}
public void setPagecount(int pagecount) {
this.pagecount = pagecount;
}
public int getBid() {
return bid;
}
public void setBid(int bid) {
this.bid = bid;
}
public String getBname() {
return bname;
}
public void setBname(String bname) {
this.bname = bname;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public Book(int bid, String bname, float price, String author, int pagecount) {
super();
this.bid = bid;
this.bname = bname;
this.price = price;
this.author = author;
this.pagecount = pagecount;
} }

  

package com.etc.model.entity;

import java.util.ArrayList;
import java.util.List; //分页的数据。对于实体对象的分页封装,必须新增分页的信息
//T为泛型参数
public class PageModel<T>
{
//分页的数据,用数组来保存!
private List<T> list= new ArrayList<T>(); //2个重要的分页参数
private int pagesize; //每页有几条
private int pageno; //第几页,从1开始 //3 总记录数
private int totalcount; //4 总页码数
private int totalpage; public List<T> getList() {
return list;
} public void setList(List<T> list) {
this.list = list;
} public int getPagesize() {
return pagesize;
} public void setPagesize(int pagesize) {
this.pagesize = pagesize;
} public int getPageno() {
return pageno;
} public void setPageno(int pageno) {
this.pageno = pageno;
} public int getTotalcount() { return totalcount;
} public void setTotalcount(int totalcount) {
this.totalcount = totalcount;
} //根据pagesize和总记录数,自动算出总页面数
public int Totalpage()
{
if(totalcount%pagesize==0) //整除
totalpage = totalcount/pagesize;
else //不整除
totalpage = totalcount/pagesize+1;
return totalpage;
}
}

  

package com.etc.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import com.etc.model.biz.BookBiz;
import com.etc.model.entity.Book;
import com.etc.model.entity.PageModel; public class BookServlet extends HttpServlet { /**
* Constructor of the object.
*/
public BookServlet() {
super();
} /**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
} /**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @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 doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { doPost(request,response);
} /**
* 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
*/
//所有mvc请求的统一入口
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//1 对请求参数进行解码
request.setCharacterEncoding("utf-8");
//2 对响应进行编码(偶尔也需要用servlet直接响应html-出错了)
response.setContentType("text/html;charset=utf-8");
//3 读取op参数
String op = request.getParameter("op"); //4 根据op的不同处理具体的不同请求
if("add".equals(op))
{
add(request,response); //添加
}
else if("findall".equals(op))
{
findall(request,response);//查询全部书
}
else if("delete".equals(op))
{
delete(request,response);//删除书
}
else if("toupdate".equals(op))
{
toupdate(request,response);//进入修改页面
}
else if("update".equals(op))
{
update(request,response);//执行修改
}
else if("findbypage".equals(op)) //新增,执行分页查询
{
findByPage(request,response);
}
} private void update(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{ //1 读取参数
int bid = Integer.parseInt(request.getParameter("bid"));
String bname = request.getParameter("bname");
float price = Float.parseFloat(request.getParameter("price"));
String author = request.getParameter("author");
int pagecount = Integer.parseInt(request.getParameter("pagecount")); //2 调用模型
Book book = new Book(bid, bname, price, author, pagecount);
BookBiz biz = new BookBiz();
if(biz.update(book))
{ //3 派发视图
//通过本地js实现信息提示并重新发起请求
String html = "<html><body><script>alert('修改成功!');window.location.href='BookServlet?op=findall';</script></body></html>";
response.getWriter().print(html);
}
else
{
String html = "<html><body>修改失败!<a href='history.back()'>返回</a></body></html>";
response.getWriter().print(html);
}
} //进入修改页面
private void toupdate(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
//1 读取请求参数
int bid = Integer.parseInt(request.getParameter("bid"));
//2 调用模型
BookBiz biz = new BookBiz();
Book book = biz.findByBid(bid);
//3 派发视图
//在作用域保存数据
request.setAttribute("book", book);
//转发
request.getRequestDispatcher("update.jsp").forward(request, response);
} // 执行删除
private void delete(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
//1 读取请求参数
int bid = Integer.parseInt(request.getParameter("bid"));
//2 调用模型
BookBiz biz = new BookBiz();
if(biz.delete(bid))
{
//3 派发视图
//通过本地js实现信息提示并重新发起请求
String html = "<html><body><script>alert('删除成功!');window.location.href='BookServlet?op=findall';</script></body></html>";
response.getWriter().print(html);
}
else
{
String html = "<html><body>删除失败!<a href='history.back()'>返回</a></body></html>";
response.getWriter().print(html);
} } //查询全部
private void findall(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
//1 读取请求参数,无需
//2 调用模型
BookBiz biz = new BookBiz();
List<Book> list = biz.findAll(); //3 派发视图
if(list!=null) //查询成功
{
//作用域保存数据
request.setAttribute("list", list);
request.setAttribute("canshow", false);
request.setAttribute("msg", "");
request.getRequestDispatcher("showlist.jsp").forward(request, response);
}
else //失败
{
String html = "<html><body>查询失败!<a href='history.back()'>返回</a></body></html>";
response.getWriter().print(html);
}
} //查询指定页码
private void findByPage(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
//1 读取请求参数,
int pageno = Integer.parseInt(request.getParameter("pageno"));
int pagesize = Integer.parseInt(request.getParameter("pagesize"));
//2 调用模型
BookBiz biz = new BookBiz();
PageModel<Book> pm = biz.findByPage(pageno,pagesize); //3 派发视图
if(pm!=null) //查询成功
{
//作用域保存数据
request.setAttribute("pm", pm);
request.setAttribute("canshow", false);
request.setAttribute("msg", "");
request.getRequestDispatcher("showlist.jsp").forward(request, response);
}
else //失败
{
String html = "<html><body>查询失败!<a href='history.back()'>返回</a></body></html>";
response.getWriter().print(html);
}
} //处理add的请求
private void add(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
//1 读取请求参数
String bname = request.getParameter("bname");
float price = Float.parseFloat(request.getParameter("price"));
String author = request.getParameter("author");
int pagecount = Integer.parseInt(request.getParameter("pagecount")); //2 调用模型
//创建模型-实体bean
Book book = new Book(-1, bname, price,author,pagecount);
BookBiz biz = new BookBiz();
if(biz.add(book)) //成功,那么???
{
//3 派发视图
//转发到"查询全部"的请求命令
request.getRequestDispatcher("BookServlet?op=findall").forward(request, response); }
else //失败
{
String html = "<html><body>添加失败!<a href='javascript:history.back()'>返回</a></body></html>";
response.getWriter().print(html);
}
} /**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
} }

  

package com.etc.model.biz;

import java.util.List;

import com.etc.model.dao.BookDao;
import com.etc.model.entity.Book;
import com.etc.model.entity.PageModel;
//业务bean,实现具体的业务逻辑
public class BookBiz
{
private BookDao dao = new BookDao();
//添加书,返回是否成功
public boolean add(Book book) //添加书,返回是否添加成功!
{
//靠dao对象来实现具体的数据库操作
return dao.add(book);
} //查询全部的数
public List<Book> findAll()
{
//靠dao对象来实现具体的数据库操作
return dao.findAll();
}
//删除书,返回是否成功
public boolean delete(int bid) //删除书,返回是否添加成功!
{
//靠dao对象来实现具体的数据库操作
return dao.delete(bid);
}
//查询指定 编号的书,用于进入修改页面
public Book findByBid(int bid)
{
return dao.findByBid(bid);
} //修改书,返回是否成功
public boolean update(Book book) //修改书,返回是否添加成功!
{
//靠dao对象来实现具体的数据库操作
return dao.update(book);
}
//查找第n页的书
public PageModel<Book> findByPage(int pageno,int pagesize)
{
return dao.findByPage(pageno, pagesize);
}
}

  

package com.etc.model.dao;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List; import com.etc.model.entity.Book;
import com.etc.model.entity.PageModel;
import com.etc.utils.JDBCUtil; //实现所有数据库的操作
public class BookDao {
//实现书的添加!返回是否成功!
public boolean add(Book book)
{
//通过jdbc工具类来实现添加
String sql = "insert into book(bname,price,author,pagecount) "
+" values(?,?,?,?)";
String[] ps = {book.getBname(),book.getPrice()+"",book.getAuthor(),book.getPagecount()+""};
return JDBCUtil.doUpdate(sql, ps)==1;
}
//实现书的删除!返回是否成功!
public boolean delete(int bid)
{
//通过jdbc工具类来实现添加
String sql = "delete from book where bid=?";
String[] ps = {bid+""};
return JDBCUtil.doUpdate(sql, ps)==1;
} //实现书的全部查询
public List<Book> findAll()
{
List<Book> list = new ArrayList<Book>(); String sql = "select * from book";
ResultSet rs = JDBCUtil.doQuery(sql);
try {
//依次遍历记录
while (rs.next()) {
//读取每条记录的字段值
int bid = rs.getInt("bid");
String bname = rs.getString("bname");
float price = rs.getFloat("price");
String author = rs.getString("author");
int pagecount = rs.getInt("pagecount");
//创建对象并添加到数组中
list.add(new Book(bid, bname, price, author, pagecount));
}
} catch (Exception e) {
return null;
}
finally
{
JDBCUtil.close(rs);
}
return list;
}
//实现指定 编号的书的查询
public Book findByBid(int bid)
{
Book book = null; String sql = "select * from book where bid = ?";
String[] ps = {bid+""};
ResultSet rs = JDBCUtil.doQuery(sql,ps);
try {
//依次遍历记录
if (rs.next()) {
//读取每条记录的字段值
String bname = rs.getString("bname");
float price = rs.getFloat("price");
String author = rs.getString("author");
int pagecount = rs.getInt("pagecount");
//创建对象并添加到数组中
book = new Book(bid, bname, price, author, pagecount);
}
else //找不到,返回空
return null;
} catch (Exception e) {
return null;
}
finally
{
JDBCUtil.close(rs);
}
return book;
}
//实现书的修改!返回是否成功!
public boolean update(Book book)
{
//通过jdbc工具类来实现添加
String sql = "update book set bname=?,price=?,author=?,pagecount=? where bid=?";
String[] ps = {book.getBname(),book.getPrice()+"",book.getAuthor(),book.getPagecount()+"",book.getBid()+""};
return JDBCUtil.doUpdate(sql, ps)==1;
}
//获得书本的总的记录数
private int getTotalCount()
{
String sql = "select count(1) as t from book"; ResultSet rs = JDBCUtil.doQuery(sql);
try {
//依次遍历记录
rs.next();
return rs.getInt("t"); //返回记录数
} catch (Exception e) {
return -1;
}
finally
{
JDBCUtil.close(rs);
}
}
//实现指定页面数的书的查询
public PageModel<Book> findByPage(int pageno,int pagesize)
{
List<Book> list = new ArrayList<Book>(); String sql = "select * from book limit "+
pagesize*(pageno-1)+","+pagesize;
//设置起点和条数
ResultSet rs = JDBCUtil.doQuery(sql);
try {
//依次遍历记录
while (rs.next()) {
//读取每条记录的字段值
int bid = rs.getInt("bid");
String bname = rs.getString("bname");
float price = rs.getFloat("price");
String author = rs.getString("author");
int pagecount = rs.getInt("pagecount");
//创建对象并添加到数组中
list.add(new Book(bid, bname, price, author, pagecount));
}
PageModel<Book> pm = new PageModel<Book>();
pm.setList(list); //该页装载的记录数
pm.setPageno(pageno); //页面数
pm.setPagesize(pagesize); //每页有几条
int count = getTotalCount();//获得总的记录数
pm.setTotalcount(count); //总的记录数
return pm;
} catch (Exception e) {
return null;
}
finally
{
JDBCUtil.close(rs);
}
} }

  

ee_15_mvc_db_page----demo---bai的更多相关文章

  1. 通过一个demo了解Redux

    TodoList小demo 效果展示 项目地址 (单向)数据流 数据流是我们的行为与响应的抽象:使用数据流能帮我们明确了行为对应的响应,这和react的状态可预测的思想是不谋而合的. 常见的数据流框架 ...

  2. 很多人很想知道怎么扫一扫二维码就能打开网站,就能添加联系人,就能链接wifi,今天说下这些格式,明天做个demo

    有些功能部分手机不能使用,网站,通讯录,wifi基本上每个手机都可以使用. 在看之前你可以扫一扫下面几个二维码先看看效果: 1.二维码生成 网址 (URL) 包含网址的 二维码生成 是大家平时最常接触 ...

  3. 在线浏览PDF之PDF.JS (附demo)

    平台之大势何人能挡? 带着你的Net飞奔吧!:http://www.cnblogs.com/dunitian/p/4822808.html#skill 下载地址:http://mozilla.gith ...

  4. 【微框架】Maven +SpringBoot 集成 阿里大鱼 短信接口详解与Demo

    Maven+springboot+阿里大于短信验证服务 纠结点:Maven库没有sdk,需要解决 Maven打包找不到相关类,需要解决 ps:最近好久没有写点东西了,项目太紧,今天来一篇 一.本文简介 ...

  5. vue双向数据绑定原理探究(附demo)

    昨天被导师叫去研究了一下vue的双向数据绑定原理...本来以为原理的东西都非常高深,没想到vue的双向绑定真的很好理解啊...自己动手写了一个. 传送门 双向绑定的思想 双向数据绑定的思想就是数据层与 ...

  6. Android Studio-—使用OpenCV的配置方法和demo以及开发过程中遇到的问题解决

    前提: 1.安装Android Studio(过程略) 2.官网下载OpenCV for Android 网址:http:opencv.org/downloads.html 我下载的是下图的版本 3. ...

  7. iOS之ProtocolBuffer搭建和示例demo

    这次搭建iOS的ProtocolBuffer编译器和把*.proto源文件编译成*.pbobjc.h 和 *.pbobjc.m文件时,碰到不少问题! 搭建pb编译器到时没有什么问题,只是在把*.pro ...

  8. 钉钉开放平台demo调试异常问题解决:hostname in certificate didn't match

    今天研究钉钉的开放平台,结果一个demo整了半天,这帮助系统写的也很难懂.遇到两个问题: 1.首先是执行demo时报unable to find valid certification path to ...

  9. 无限分级和tree结构数据增删改【提供Demo下载】

    无限分级 很多时候我们不确定等级关系的层级,这个时候就需要用到无限分级了. 说到无限分级,又要扯到递归调用了.(据说频繁递归是很耗性能的),在此我们需要先设计好表机构,用来存储无限分级的数据.当然,以 ...

  10. 轻量级通信引擎StriveEngine —— C/S通信demo(附源码)

    前段时间,有几个研究ESFramework的朋友对我说,ESFramework有点庞大,对于他们目前的项目来说有点“杀鸡用牛刀”的意思,因为他们的项目不需要文件传送.不需要P2P.不存在好友关系.也不 ...

随机推荐

  1. Android(java)学习笔记133:ListViewProject案例(ListView + BaseAdapter + CheckBox)

    这个案例可能稍微复杂一点,我会讲述详细一点: 1.首先是AndroidManifest.xml: <?xml version="1.0" encoding="utf ...

  2. 我的开发框架(WinForm)2

    上篇文章简单的介绍了一下,我的一个开发框架.看的人还不少,多谢大家的关注,我继续介绍一下,模块和模块之间是怎么组织起来的. Data模块: 该模块主要完成对数据的操作,采用仓储模式实现,在核心模块(C ...

  3. Discuz论坛架构改造

    这个论坛一直通过NFS服务共享文件给三台web服务器做负载均衡. 在实际环境中WEB Server总是出现CPU负载突然升高.文件交互的网络流量异常.甚至WEB Server夯死,NFS不能卸载,只能 ...

  4. gcc的使用

    为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处.LaplaceDemon/ShiJiaqi. http://www.cnblogs.com/shijiaqi1066/p/6065410. ...

  5. [转]在64位的环境中使用VS建立Web项目进行Oracle连接需要注意WebDev是32位的

    本文转自:http://www.cnblogs.com/studyzy/archive/2010/10/28/1863056.html 我们平时使用的都是32位的机器进行开发,装的都是32位的软件,但 ...

  6. 关于事件监听机制的总结(Listener和Adapter)

    记得以前看过事件监听机制背后也是有一种设计模式的.(设计模式的名字记不清了,只记得背后实现的数据结构是数组.) 附上事件监听机制的分析图: 一个事件源可以承载多个事件(只要这个事件源支持这个事件就可以 ...

  7. 在安卓下使用python连接蓝牙串口模块(HC-06)

    在安卓上安装Python: 请参考:https://github.com/kuri65536/python-for-android/blob/master/README.md下载程序文件需要访问 ht ...

  8. Opencv——灰度直方图

    灰度直方图是灰度级的函数,它表示图像中具有某种灰度级的像素的个数,反映了图像中某种灰度出现的频率. 如果将图像总像素亮度(灰度级别)看成是一个随机变量,则其分布情况就反映了图像的统计特性,这可用pro ...

  9. xp 中的IIS安装成功之后,访问网页显示没有权限访问解决方法

    在做xp的IIS发布网站时遇到一个问题就是当你访问网站的时候,显示没有权限访问网站,但是我已经开启了匿名访问网站了,怎么还没有权限访问呢?后来经过上网搜资料解决,当时很多网上都说没打开匿名访问,当时我 ...

  10. ubuntu 恢复gnome-panel

    Ubuntu重启panel 的方法首先进入终端, 依次输入以下命令1.gconftool --recursive-unset /apps/panel2.rm -rf ~/.gconf/apps/pan ...