wlf
zhai_lw 6 years ago
parent e0b4bcf1cf
commit 76ae5cc87a

@ -1,4 +1,5 @@
0 windows home 1809
1 java jdk10 默认路径
2 tomcat8.5 默认路径
3
3 mariaDB10.3 默认路径
4

@ -37,8 +37,6 @@ public abstract class Operation {
}
this.options.put(key,value);
}
public void execute(User subject){
this.subject = subject;
}
public abstract void execute(User subject);
}

@ -0,0 +1,17 @@
package core.operation;
import core.user.User;
import dao.DBManagement;
import java.util.Map;
public class Select extends Operation {
private Map<String, Object> options;
private User subject;
@Override
public void execute(User subject) {
this.setSubject(subject);
DBManagement.update("update stu ");
}
}

@ -7,6 +7,7 @@ import core.user.User;
public class AtomProcess extends Process {
private String permission;
private Operation operation;
private String ButtonName;
private String info;
private String processOptions;

@ -2,6 +2,7 @@ package dao;
import java.sql.*;
import error.GExcptSQL;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.apache.tomcat.jdbc.pool.PoolProperties;
@ -41,7 +42,7 @@ public class DBManagement {
return null;
}
public static ResultSet query(String sql) {
public static ResultSet query(String sql) throws Exception {
if(!ifInit) return null;
ResultSet rs = null;
Connection con = null;
@ -50,19 +51,19 @@ public class DBManagement {
Statement stmt = con.createStatement();
rs = stmt.executeQuery(sql);
} catch (SQLException e) {
e.printStackTrace();
throw new GExcptSQL("Connect Failure");
}finally {
if(con!=null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
throw new GExcptSQL("Connection Close Failure");
}
}
}
return rs;
}
public static void update(String sql) {
public static void update(String sql) throws GExcptSQL {
if(!ifInit) return;
Connection con = null;
try{
@ -70,14 +71,14 @@ public class DBManagement {
Statement stmt = con.createStatement();
stmt.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
throw new GExcptSQL("Connect Failure");
}finally {
if(con!=null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
throw new GExcptSQL("Connection Close Failure");
}
}
}
}

@ -0,0 +1,10 @@
package error;
import core.operation.Operation;
public abstract class GExcpt extends Exception {
String info;
public GExcpt(String info){
this.info = info;
}
}

@ -0,0 +1,8 @@
package error;
public class GExcptSQL extends GExcpt {
public GExcptSQL(String info) {
super(info);
}
}

@ -0,0 +1,17 @@
<%--
Created by IntelliJ IDEA.
User: zhai_
Date: 2019/1/9
Time: 10:10
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<script type="text/javascript" src="test2.js"></script>
</head>
<body>
</body>
</html>

@ -0,0 +1,4 @@
function a(){
alert(123);
}
window.onload=a();
Loading…
Cancel
Save