%--
Created by IntelliJ IDEA.
User: vie
Date: 2019/12/30
Time: 10:04
To change this template use File | Settings | File Templates.
--%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
学生信息
<%
String driver = "com.mysql.cj.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/test?characterEncoding=utf-8"
+"&serverTimezone=GMT"+ "&useUnicode=true"+"&useSSL=false" ;
String usr = "root";
String password = "123456";
Class.forName("com.mysql.cj.jdbc.Driver");
Connection conn = DriverManager.getConnection(url, usr, password);
String sqlString = "select * from electricity";
PreparedStatement pstmt = conn.prepareStatement(sqlString);
ResultSet rs = pstmt.executeQuery();
%>
<%--欢迎你,<%=request.getParameter("username")%>--%>
<%--
退出--%>
<%--
--%>
宿舍电费列表
宿舍号 |
电费余额 |
操作 |
<%
while (rs.next()) {
out.println("");
out.println("" + rs.getString("Electricity_id") + " | ");
out.println("" + rs.getString("Electricity_cost") + " | ");
out.println("修改 | ");
out.println("
");
}
%>
<%!Date time= new Date();%>
<%
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日 E HH时mm分ss秒");
%>
<% out.println(sdf1.format(time)); %>