四月十一日

今天写了一点团队项目的内容

package Dao;
public class dao {
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPeople() {
        return people;
    }
    public void setPeople(String people) {
        this.people = people;
    }
    public String getNumber() {
        return number;
    }
    public void setNumber(String number) {
        this.number = number;
    }
    public String getTimu() {
        return timu;
    }
    public void setTimu(String timu) {
        this.timu = timu;
    }
    public String getJiaoshipingjia() {
        return jiaoshipingjia;
    }
    public void setJiaoshipingjia(String jiaoshipingjia) {
        this.jiaoshipingjia = jiaoshipingjia;
    }
    public String getXiaozupingfen() {
        return xiaozupingfen;
    }
    public void setXiaozupingfen(String xiaozupingfen) {
        this.xiaozupingfen = xiaozupingfen;
    }
    public String getMingci() {
        return mingci;
    }
    public void setMingci(String mingci) {
        this.mingci = mingci;
    }
    String name;
    String people;
    String number;
    String timu;
    String jiaoshipingjia;
    String xiaozupingfen;
    String mingci;

}
package Dbutil;
import java.sql.*;
public class db {
    //eshop为数据库名称,db_user为数据库用户名db_password为数据库密码
    public static String db_url = "jdbc:mysql://localhost:3306/ceshi?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT";
    public static String db_user = "root";
    public static String db_password = "NN06280055";
    public static Connection getConn() {
        Connection conn = null;
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            conn = DriverManager.getConnection(db_url, db_user, db_password);
            System.out.println("连接成功");
        } catch (Exception e) {
            System.out.println("连接失败");
            e.printStackTrace();
        }
        return conn;
    }
    public static void close(Statement state, Connection conn) {
        if(state!=null) {
            try {
                state.close();
            } catch (SQLException e) {
                e.printStackTrace();    
            }
        }    
        if(conn!=null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
    public static void close(ResultSet rs, Statement state, Connection conn) {
        if(rs!=null) {
            try {
                rs.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        if(state!=null) {
            try {
                state.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        if(conn!=null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
public static void main(String[] args)
{
    return;
    }
}
View Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在此处插入标题</title>
</head>
<body>
<form action="add1.jsp" method="get">
<table align="center" border="1" width="500">
    <div id="dateTime"></div>
<tr>
        <td>队名</td>
        <td><input type="text" name="name" /></td>

</tr>
<tr>
        <td>参赛人员</td>
        <td><input type="text" name="people" /></td>

</tr>
<tr>
        <td>参赛人数</td>
        <td><input type="text" name="number" /></td>

</tr>
<tr>
        <td>选题</td>
        <td><input type="text" name="xuanti" /></td>

</tr>
<tr>
        <td>教师评价</td>
        <td><input type="text" name="jiaoshipingjia" /></td>

</tr>
<tr>
        <td>小组评分</td>
        <td><input type="text" name="xiaozupingfen" /></td>

</tr>
<tr>
        <td>名次</td>
        <td><input type="text" name="mingci" /></td>

</tr>
<tr align="center">
                <td colspan="2"><input type="submit" value="提交" /></td>
            </tr>
            <input type="button" value="继续添加" onclick="location.href='add.jsp'" /></br>
</body>
</html>
View Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@ page import="Dao.dao"%>
    <%@ page import="Dao.hanshu"%>
    <%@ page import="Dbutil.db"%>
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在此处插入标题</title>
</head>
<body>
<%
String name = request.getParameter("name");
String people = request.getParameter("people");
String number = request.getParameter("number");
String xuanti = request.getParameter("xuanti");
String jiaoshipingjia = request.getParameter("jiaoshipingjia");
String xiaozupingfen = request.getParameter("xiaozupingfen");
String mingci = request.getParameter("mingci");
hanshu.creat(name, people, number, xuanti, jiaoshipingjia, xiaozupingfen, mingci);
%>
<input type="button" value="返回继续添加" onclick="location.href='add.jsp'" /></br>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在此处插入标题</title>
</head>
<body>
<form action="update1.jsp" method="get">
<table align="center" border="1" width="500">
<tr>
        <td>队名</td>
        <td><input type="text" name="name" /></td>

</tr>
<tr>
        <td>参赛人员</td>
        <td><input type="text" name="people" /></td>

</tr>
<tr>
        <td>参赛人数</td>
        <td><input type="text" name="number" /></td>

</tr>
<tr>
        <td>选题</td>
        <td><input type="text" name="xuanti" /></td>

</tr>
<tr>
        <td>教师评价</td>
        <td><input type="text" name="jiaoshipingjia" /></td>

</tr>
<tr>
        <td>小组评分</td>
        <td><input type="text" name="xiaozupingfen" /></td>

</tr>       
            <tr align="center">

                <td colspan="2"><input type="submit" value="提交" /></td>

            </tr>


</body>
</html>
View Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="Dao.dao" %>
<%@page import="Dao.hanshu" %>
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在此处插入标题</title>
</head>
<body>
<%
String name = request.getParameter("name");
String people = request.getParameter("people");
String number = request.getParameter("number");
String xuanti = request.getParameter("xuanti");
String jiaoshipingjia = request.getParameter("jiaoshipingjia");
String xiaozupingfen = request.getParameter("xiaozupingfen");
hanshu.update(name,people,number,xuanti,jiaoshipingjia,xiaozupingfen,name);
%>
<input type="button" value="返回" onclick="location.href='welcome.jsp'" /></br>
</body>
</html>
View Code

 

posted @ 2023-04-11 22:11  布吉岛???  阅读(24)  评论(0编辑  收藏  举报