错在哪里 大神们 求解啊

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page import = "java.sql.*"%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Insert title here</title>

</head>

<%

 Class.forName("com.mysql.jdbc.Driver");

String url = "jdbc:mysql://localhost:3306/book";

Connection con = DriverManager.getConnection(url,"root","root");

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery("select * from stu");

%>

 

<h1>学生信息</h1>

<table border = "1" width = "95%">

<tr>

<th>name</th>

<th>pwd</th>

<th>email</th>

<th>qq</th>

</tr>

<%while(rs.next()){ %>

<tr>

<td><%=rs.getString("username") %></td>

<td><%=rs.getString(2) %></td>

<td><%=rs.getString("email") %></td>

<td><%=rs.getString("qq") %></td>

</tr>

<%} %>

</table>

<% 

rs.close();

stmt.close();

con.close();

%>

</body>

</html>


qq_白水_04341277
浏览 1074回答 1
1回答

慕粉3291149

吧代码放到try  catch语句块中运行

慕瓜9220888

DSTSECIJJDBAJJOLIPTOATIFTZKITSBKBIICBZBATAMTXWLEJILZPQYTFLKNURIOCVUGNWMWVGPONULBLIGFENWJQGMRDCLIPQAXILBTXUUEPNJFISZKCWEXQIFZQQIETZRLSJBCQHKTQXNBIQGVUKLSCZHAZSVFTAPDWZRKHRRSQTSHEFMWPXWVEVCCEAZCBVMMWDBTVEDQHEEWUDMVCPZZCHGFELKAKXSBJCPGQHRJIRAXFSZMEXLKBRYIEAJIHEFPJGBJIJKAPJBJIHAAHXOWENWIFZGSCBVRAUEEFEWVNGKQXHCKTMVVVGGEGQTSPZJUESBKJQNOUFNTVYOFWYAONJANKRSQEXQIFWNNKSVUDGPMWSNWSHWDUUXVUNVGWXHOWMUHKRYYNGRRWJMNXHVLGZUIPZOWVXGGXEWVNCEUHELVTYHIULOLCCBJZIVFEOAYONGGRH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