• 语言:java、javascript
  • 软件:eclipse、mysql

  环境配置:下载jdk;配置jdk环境变量。相关教程:https://jingyan.baidu.com/article/db55b609fa946e4ba20a2f56.html

  配置Tomcat、以及mysql的安装,jdbc的下载。

  编写一个网页完成课程的增删改查,要求连接数据库并且实现增删改查。

  首先创建一个java web项目File->new->Other->Dynamic Web Project

创建名称->点击next

点击next,将选项打上对号:

点击完成:

jdbc的链接:下载jdbc。在项目文件位置创建lib文件夹将下载jdbc中的粘贴到lib文件夹下。

在项目上点击右键选择最后一个Properties(属性)选项。

选择java build path中的Libraries

点击右侧的ARR JARs...选择刚才粘贴的文件。最后点击Apply and Close

出现Referenced Libraries证明添加成功。

在WebContent上点击右键new->jsp文件:创建多个jsp文件实现网页的实现。在java Resources中创建java项目链接编写数据库的代码并封装成类。

源代码:

Shujuku.java:

package Class;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; public class Shujuku {
public String[][] Getinformation() {
Connection con;
//驱动程序名
String driver = "com.mysql.jdbc.Driver";
//URL指向要访问的数据库名mydata
String url = "jdbc:mysql://localhost:3306/class?serverTimezone=UTC";
//MySQL配置时的用户名
String user = "root";
//MySQL配置时的密码
String password = "1234567";
//遍历查询结果集
String [][] st;
st=new String [20][3];
int i=0;
try {
//加载驱动程序
Class.forName(driver);
//1.getConnection()方法,连接MySQL数据库!!
con = DriverManager.getConnection(url,user,password);
//2.创建statement类对象,用来执行SQL语句!!
Statement statement = con.createStatement();
//要执行的SQL语句
String sql = "select * from class";
//3.ResultSet类,用来存放获取的结果集!!
ResultSet rs = statement.executeQuery(sql);
while(rs.next()){
st[i][0] = rs.getString("课程名称");
st[i][1] = rs.getString("任课教师");
st[i][2] = rs.getString("任课地点");
i++;
if(i==19)break;
}
rs.close();
con.close();
} catch(ClassNotFoundException e) {
System.out.println("Sorry,can`t find the Driver!");
e.printStackTrace();
} catch(SQLException e) {
//数据库连接失败异常处理
e.printStackTrace();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return st;
}
public void add(String id,String newname,String newpwd) {
Connection con;
//驱动程序名
String driver = "com.mysql.jdbc.Driver";
//URL指向要访问的数据库名mydata
String url = "jdbc:mysql://localhost:3306/class?serverTimezone=UTC";
//MySQL配置时的用户名
String user = "root";
//MySQL配置时的密码
String password = "1234567";
//遍历查询结果集
try {
//加载驱动程序
Class.forName(driver);
//1.getConnection()方法,连接MySQL数据库!!
con = DriverManager.getConnection(url,user,password);
//3.ResultSet类,用来存放获取的结果集!!
PreparedStatement psql;
//预处理添加数据,其中有两个参数--“?”
psql = con.prepareStatement("insert into class (课程名称,任课教师,任课地点) "
+ "values(?,?,?)");
psql.setString(1, id); //设置参数1,创建id为3212的数据
psql.setString(2, newname); //设置参数2,name 为王刚
psql.setString(3, newpwd);
psql.executeUpdate(); //执行更新
con.close();
} catch(ClassNotFoundException e) {
System.out.println("Sorry,can`t find the Driver!");
e.printStackTrace();
} catch(SQLException e) {
//数据库连接失败异常处理
e.printStackTrace();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
public void update(String id,String newname,String newteachername,String newclassadd) {
Connection con;
//驱动程序名
String driver = "com.mysql.jdbc.Driver";
//URL指向要访问的数据库名mydata
String url = "jdbc:mysql://localhost:3306/class?serverTimezone=UTC";
//MySQL配置时的用户名
String user = "root";
//MySQL配置时的密码
String password = "1234567";
//遍历查询结果集
try {
//加载驱动程序
Class.forName(driver);
//1.getConnection()方法,连接MySQL数据库!!
con = DriverManager.getConnection(url,user,password);
PreparedStatement psql;
//预处理更新(修改)数据,将王刚的sal改为5000.0
psql = con.prepareStatement("update class set 课程名称 = ? , 任课教师=?, 任课地点=? where 课程名称 = ?");
psql.setString(1,newname);
psql.setString(2,newteachername);
psql.setString(3,newclassadd);
psql.setString(4,id);
psql.executeUpdate();
con.close();
} catch(ClassNotFoundException e) {
System.out.println("Sorry,can`t find the Driver!");
e.printStackTrace();
} catch(SQLException e) {
//数据库连接失败异常处理
e.printStackTrace();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
public void delte(String id) {
Connection con;
//驱动程序名
String driver = "com.mysql.jdbc.Driver";
//URL指向要访问的数据库名mydata
String url = "jdbc:mysql://localhost:3306/class?serverTimezone=UTC";
//MySQL配置时的用户名
String user = "root";
//MySQL配置时的密码
String password = "1234567";
//遍历查询结果集
try {
//加载驱动程序
Class.forName(driver);
//1.getConnection()方法,连接MySQL数据库!!
con = DriverManager.getConnection(url,user,password);
//3.ResultSet类,用来存放获取的结果集!!
PreparedStatement psql;
//预处理删除数据
psql = con.prepareStatement("delete from class where 课程名称 =?");
psql.setString(1, id);
psql.executeUpdate();
psql.close();
con.close();
} catch(ClassNotFoundException e) {
System.out.println("Sorry,can`t find the Driver!");
e.printStackTrace();
} catch(SQLException e) {
//数据库连接失败异常处理
e.printStackTrace();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}

xuanke.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>选课网站</title>
<style>
nav{ width:100%; height:20px; background:#DCDCDC ; text-align:center;}
a { text-decoation:none;}
</style>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<div id=Layer1 style="position:absolute; ;z-index:1;left: 0px;top:50px;">
<table border="1" >
<tr bgcolor="#DCDCDC"><td></td></tr>
<tr><td align="center" bgcolor=Aqua>课程管理</td></tr>
<tr><td align="center"> <a href="Addclass.jsp">添加课程</a></td></tr>
<tr><td align="center"> <a href="Showclass.jsp">查看课程信息</a></td></tr>
<tr><td align="center"> <a href="Searchclass.jsp">查询课程信息</a></td></tr>
</table>
​</div>
</body>
</html>

addClass.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加课程</title>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<form action="Add.jsp" method="post">
<div>
<table style="margin:0 auto">
<tr><td style="width:120px"align="right">课程名称:</td>
<td> <input style="width:80px;height:17px;" type="text" name="classname"id="classname"/></td></tr>
<tr><td style="width:120px"align="right">任课教师:</td>
<td> <input style="width:80px;height:17px;" type="text" name="teachername"id="teachername"/></td>
<td style="width:120px"align="left"><small>从王建民、刘立嘉、刘丹、杨子光、王辉中选择。:</small></td></tr>
<tr><td style="width:120px"align="right">任课地点:</td>
<td> <input style="width:80px;height:17px;" type="text" name="classadd"id="classadd"/></td></tr>
<tr><td><button id="anniu" style="width:100px;height:30px;margin:0 auto" type="submit" >确认</button></td>
<td><button id="anniu" style="width:100px;height:30px;margin:0 auto" type="button" onclick="javascript:back();">取消</button></td></tr>
</table>
</div>
</form>
<script type="text/javascript">
function back(){
window.location.href="Xuanke.jsp?act=Xuanke"
}
</script>
</body>
</html>

add,jsp:

<%@ page import="javax.swing.*" %>
<%@page import="Class.Shujuku"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加课程</title>
<style>
nav{ width:100%; height:20px; background:#DCDCDC ; text-align:center;}
a { text-decoation:none;}
</style>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<%
request.setCharacterEncoding("UTF-8");
Shujuku shu=new Shujuku();
String newname=request.getParameter("classname");
String newpassword=request.getParameter("teachername");
String classaddname=request.getParameter("classadd");
String st[][];
st=shu.Getinformation();
int i=0;
boolean m=true,n=false,q=true;
for(;st[i][0]!=null;i++){
if(newname.equals(st[i][0])){m=false;break;}
}
if(newpassword.equals("王建民")||newpassword.equals("刘丹")||newpassword.equals("刘立嘉")||newpassword.equals("王辉")||newpassword.equals("杨子光"))n=true;
if((classaddname.indexOf("基教")==-1)&&(classaddname.indexOf("一教")==-1)&&(classaddname.indexOf("二教")==-1)&&(classaddname.indexOf("三教")==-1))q=false;
if(m==true&&n==true&&q==true){
shu.add(newname, newpassword, classaddname);
%>
<script type="text/javascript">
alert("添加成功");
window.location.href="Xuanke.jsp?act=Xuanke"
</script>
<%}else{if(m==false){ %>
<script type="text/javascript">
alert("该课程已存在");
window.location.href="Xuanke.jsp?act=Xuanke"
</script>
<%} %>
<script type="text/javascript">
alert("输入格式不正确");
window.location.href="Addclass.jsp?act=Addclass"
</script>
<%} %>
</body>
</html>

ChangeClass.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改课程信息</title>
<style>
nav{ width:100%; height:20px; background:#DCDCDC ; text-align:center;}
</style>
<script>
function back(){
window.location.href="Change.jsp?act=Change"
}
</script>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<form action="Change.jsp">
<div>
<table align="center">
<tr><td style="width:200px"align="right">请输入课程名称:</td>
<td> <input style="width:100px;height:20px;" type="text" name="classname"id="classname"/></td>
</tr>
<tr>
<td style="width:200px"align="right">请输入新的课程名称:</td>
<td> <input style="width:100px;height:20px;" type="text" name="newclassname"id="newclassname"/></td>
</tr>
<tr>
<td style="width:200px"align="right">请输入新的任课教师:</td>
<td> <input style="width:100px;height:20px;" type="text" name="newteachername"id="newteachername"/></td>
</tr>
<tr>
<td style="width:200px"align="right">请输入新的任课地点:</td>
<td> <input style="width:100px;height:20px;" type="text" name="newclassaddname"id="newclassaddname"/></td>
</tr>
<tr>
<td><button id="anniu" style="width:100px;height:30px;margin:0 auto" type="submit" >确认</button></td>
<td><button id="anniu2" style="width:100px;height:30px;margin:0 auto" type="submit" onclick="jscripet:back();">取消</button></td>
</tr>
</table>
</div>
</form>
</body>
</html>

Change.jsp:

<%@ page import="javax.swing.*" %>
<%@page import="Class.Shujuku"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改课程信息</title>
<style>
nav{ width:100%; height:20px; background:#DCDCDC ; text-align:center;}
</style>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<%
request.setCharacterEncoding("UTF-8");
Shujuku shu=new Shujuku();
String classname=request.getParameter("classname");
String newclassname=request.getParameter("newclassname");
String teachername=request.getParameter("newteachername");
String classaddname=request.getParameter("newclassaddname");
String st[][];
st=shu.Getinformation();
int i=0;
boolean m=true,n=false,q=true;
for(;st[i][0]!=null;i++){
if(!(classname.equals(st[i][0]))&&newclassname.equals(st[i][0])){m=false;break;}
}
if(teachername.equals("王建民")||teachername.equals("刘丹")||teachername.equals("刘立嘉")||teachername.equals("王辉")||teachername.equals("杨子光"))n=true;
if((classaddname.indexOf("基教")==-1)&&(classaddname.indexOf("一教")==-1)&&(classaddname.indexOf("二教")==-1)&&(classaddname.indexOf("三教")==-1))q=false;
if(m==true&&n==true&&q==true){
shu.update(classname, newclassname,teachername,classaddname);
%>
<script type="text/javascript">
alert("修改成功");
window.location.href="Showclass.jsp?act=Showclass"
</script>
<%}else{if(m==false){ %>
<script type="text/javascript">
alert("该课程已存在");
window.location.href="Changeclass.jsp?act=Changeclass"
</script>
<%} %>
<script type="text/javascript">
alert("输入格式不正确");
window.location.href="Changeclass.jsp?act=Changeclass"
</script>
<%} %>
</body>
</html>

DelteClass.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>删除课程信息</title>
<style>
nav{ width:100%; height:20px; background:#DCDCDC ; text-align:center;}
</style>
<script>
function back(){
window.location.href="Change.jsp?act=Change"
}
</script>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<form action="Delte.jsp">
<div>
<table align="center">
<tr><td style="width:200px"align="right">请输入要删除的课程名称:</td>
<td> <input style="width:100px;height:20px;" type="text" name="classname"id="classname"/></td>
</tr>
<tr>
<td><button id="anniu" style="width:100px;height:30px;margin:0 auto" type="submit" >确认</button></td>
<td><button id="anniu2" style="width:100px;height:30px;margin:0 auto" type="submit" onclick="jscripet:back();">取消</button></td>
</tr>
</table>
</div>
</form>
</body>
</html>

Delte.jsp:

<%@ page import="javax.swing.*" %>
<%@page import="Class.Shujuku"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改课程信息</title>
<style>
nav{ width:100%; height:20px; background:#DCDCDC ; text-align:center;}
</style>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<%
request.setCharacterEncoding("UTF-8");
Shujuku shu=new Shujuku();
String classname=request.getParameter("classname");
shu.delte(classname);
%>
<script type="text/javascript">
alert("删除成功");
window.location.href="Showclass.jsp?act=Showclass"
</script>
</body>
</html>

Searchclass.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>查询课程</title>
<style>
nav{ width:100%; height:20px; background:#DCDCDC ; text-align:center;}
a { text-decoation:none;}
</style>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<div>
<form action="Sharch.jsp">
<table border="1" align="center">
<tr><td style="width:120px"align="right">要查询的内容:</td>
<td> <input style="width:80px;height:17px;" type="text" name="name" id="name"/></td></tr>
<tr><td align="center"><button id="anniu" style="width:100px;height:30px;margin:0 auto" type="submit" >确认</button></td>
<td align="center"><button id="anniu" style="width:100px;height:30px;margin:0 auto" type="button" onclick="javascript:back();">取消</button></td></tr>
</table>
</form>
</div>
<script>
function back(){
window.location.href="Xuanke.jsp?act=Xuanke"
}
</script>
</body>
</html>

Seacher.jsp:

<%@ page import="javax.swing.*" %>
<%@page import="Class.Shujuku"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>查询课程</title>
<style>
nav{ width:100%; height:20px; background:#DCDCDC ; text-align:center;}
a { text-decoation:none;}
</style>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<%
request.setCharacterEncoding("UTF-8");
Shujuku shu=new Shujuku();
String newname=request.getParameter("name");
String [] []st;
st=shu.Getinformation();
String [][]str;
str=new String [20][3];
for(int i=0,j=0;st[i][0]!=null;i++){
if(st[i][0].indexOf(newname)!=-1){str[j]=st[i];j++;continue;}
if(st[i][1].indexOf(newname)!=-1){str[j]=st[i];j++;continue;}
if(st[i][2].indexOf(newname)!=-1){str[j]=st[i];j++;continue;}
}
%>
<div>
<table border="1" align="center">
<thead>
<tr>
<th align="center">课程名称</th>
<th align="center">任课教师</th>
<th align="center">任课地点</th>
</tr>
</thead> <%int i=0;
while(str[i][0]!=null){%>
<tr>
<td align="center"><%out.print(str[i][0]); %></td>
<td align="center"><%out.print(str[i][1]); %></td>
<td align="center"><%out.print(str[i][2]); %></td>
</tr>
<%i++;} %>
<tr align="center"><td></td>
<td><input id="anniu" style="width:100px;height:30px;margin:0 auto" type="button" onclick="javascript:back();"value="确认"></td>
<td></td></tr>
</table>
</div>
<script>
function back(){
window.location.href="Xuanke.jsp?act=Xuanke"
}
</script>
</body>
</html>

ShowClass.jsp:

<%@ page import="javax.swing.*" %>
<%@page import="Class.Shujuku"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>课程信息</title>
<%
request.setCharacterEncoding("UTF-8");
Shujuku shu=new Shujuku();
String [][] st;
int i=0;
st=shu.Getinformation();
%>
<script type="text/javascript">
function change(){
window.location.href="Changeclass.jsp?act=Change"
}
function delte(){
window.location.href="Delteclass.jsp?act=Delte"
}
</script>
<style>
nav{ width:100%; height:20px; background:#DCDCDC ; text-align:center;}
body{text-align:center}
</style>
</head>
<body>
<nav>
<p align="center">石家庄铁道大学课程管理系统</p>
</nav>
<div>
<table border="1" align="center">
<thead>
<tr>
<th align="center">课程名称</th>
<th align="center">任课教师</th>
<th align="center">任课地点</th>
</tr>
</thead> <%while(st[i][0]!=null){%>
<tr>
<td align="center"><%out.print(st[i][0]); %></td>
<td align="center"><%out.print(st[i][1]); %></td>
<td align="center"><%out.print(st[i][2]); %></td>
<td><input id="anniu[<%=i%>]" style="width:100px;height:30px;margin:0 auto" type="button" onclick="javascript:change();"value="修改"></td>
<td><input id="anniu[<%=i%>]" style="width:100px;height:30px;margin:0 auto" type="button" onclick="javascript:delte();"value="删除"></td> </tr>
<%i++;}%> </table>
</div>
</body>
</html>

java web实践的更多相关文章

  1. 根据实践经验,讲述些学习Java web能少走的弯路,内容摘自java web轻量级开发面试教程

    在和不少比较上进的初级程序员打交道的过程中,我们总结出了一些能帮到合格程序员尽快进阶的经验,从总体上来讲,多学.多实践不吃亏.本文来是从 java web轻量级开发面试教程从摘录的. 1  哪些知识点 ...

  2. Java Web前后端分离的思考与实践

    第一节 Java Web开发方式的变化 Web开发虽然是我们常说的B/S模式,其实本质上也是一种特殊的C/S模式,只不过C和S的选择余地相对要窄了不少,而且更标准化.不论是采用什么浏览器和后端框架,W ...

  3. 转:Java Web应用中调优线程池的重要性

    不论你是否关注,Java Web应用都或多或少的使用了线程池来处理请求.线程池的实现细节可能会被忽视,但是有关于线程池的使用和调优迟早是需要了解的.本文主要介绍Java线程池的使用和如何正确的配置线程 ...

  4. Java Web编程技术学习要点及方向

    学习编程技术要点及方向亮点: 传统学习编程技术落后,应跟著潮流,要对业务聚焦处理.要Jar, 不要War:以小为主,以简为宝,集堆而成.去繁取简 Spring Boot,明日之春(future of ...

  5. 初学 Java Web 开发,请远离各种框架,从 Servlet 开发

    Web框架是开发者在使用某种语言编写Web应用服务端时关于架构的最佳实践.很多Web框架是从实际的Web项目抽取出来的,仅和Web的请求和响应处 理有关,形成一个基础,在开发别的应用项目的时候则可以从 ...

  6. 【原创】三分钟教你学会MVC框架——基于java web开发(2)

    没想到我的上一篇博客有这么多人看,还有几位看完之后给我留言加油,不胜感激,备受鼓励,啥都别说了,继续系列文章之第二篇.(如果没看过我第一篇博客的朋友,可以到我的主页上先浏览完再看这篇文章,以免上下文对 ...

  7. 深入分析Java Web技术内幕(修订版)

    阿里巴巴集团技术丛书 深入分析Java Web技术内幕(修订版)(阿里巴巴集团技术丛书.技术大牛范禹.玉伯.毕玄联合力荐!大型互联网公司开发应用实践!) 许令波 著   ISBN 978-7-121- ...

  8. 大型网站系统与Java中间件实践

    大型网站系统与Java中间件实践(贯通分布式高并发高数据高访问量网站架构与实现之权威著作,九大一线互联网公司CTO联合推荐) 曾宪杰 著   ISBN 978-7-121-22761-5 2014年4 ...

  9. A candidate solution for Java Web Application - current session

    Motivation Do it once, resue for ever. Audience myself, Java Web developers Scope 应用案例 图书借阅系统 阶段1需求: ...

随机推荐

  1. CentOS 端口映射

    一个合作单位给我创建了十几台虚拟服务器做支撑.但是只给负载均衡绑定了公网IP.由于这个支撑的服务需要测试和调优,经常要往服务器上传class或者修改数据库.为了方便操作,我打算在负载均衡服务器上做端口 ...

  2. 准备面试-DFT

    问题:面试DFT岗位的准备工作 1.在EETOP上搜索DFT看到的一些要求 1.要弄明白DCSCAN.ACSCAN.MBIST.边扫等原理, 2.要会利用相应的Synopsys或Mentor公司工具! ...

  3. LibreOJ 6277. 数列分块入门 2

    题目链接:https://loj.ac/problem/6278 参考博客:https://blog.csdn.net/qq_36038511/article/details/79725027 这题我 ...

  4. linux自旋锁、互斥锁、信号量

    为了避免并发,防止竞争.内核提供了一组同步方法来提供对共享数据的保护. 我们的重点不是介绍这些方法的详细用法,而是强调为什么使用这些方法和它们之间的差别. Linux 使用的同步机制可以说从2.0到2 ...

  5. UVa 548 Tree(二叉树最短路径)

    You are to determine the value of the leaf node in a given binary tree that is the terminal node of ...

  6. 【Linux 线程】线程同步《二》

    1.读写锁 与互斥量类似,但读写锁允许更高的并行性.其特性为:写独占,读共享. 读写锁状态: 一把读写锁具备三种状态: (1)读模式下加锁状态 (读锁) (2)写模式下加锁状态 (写锁) (3)不加锁 ...

  7. Java_5 数组

    1.数组的概念与作用 数组:一组数据的集合,数组中的每个数据被称作元素.在数组中可以存放任意类型的元素,但同一个数组里存放的元素类型必须一致. 作用:可以存贮多个数据. 2.数组的使用方式 数据类型[ ...

  8. python学习笔记Day3

    set有点:1.访问速度快 2.天生解决了重复问题 tuple与set区别: 元组可重复,set不可重复创捷集合1 >>> s1.add('alex')>>> pr ...

  9. Oracle_PL/SQL(10) 定时器job

    定时器job1.定义 定时器指在特定的时间执行特定的操作. 可以多次执行.说明:特定的操作:指一个完成特定功能的存储过程.多次执行:指可以每分钟.每小时.每天.每周.每月.每季度.每年等周期性的运行. ...

  10. git 标签管理

    发布一个版本时,我们通常先在版本库中打一个标签(tag),这样,就唯一确定了打标签时刻的版本.将来无论什么时候,取某个标签的版本,就是把那个打标签的时刻的历史版本取出来.所以,标签也是版本库的一个快照 ...