The code shown below:
Find the JSP
<% @ page language="Java" import="Java. SQL. *, Java. IO. *, Java. Util. *" pageEncoding="utf-8" % & gt;
<%
String path=request.getContextPath();
String=basePath request. GetScheme () + "://" + request. GetServerName () + ":" + request. GetServerPort () + + "/" path;
% & gt;
<meta HTTP - equiv="pragma" content="no - cache" & gt;
<meta HTTP - equiv="cache-control" content="no - cache" & gt;
<meta HTTP - equiv="expires" content="0" & gt;
<meta HTTP - equiv="keywords" content="keyword1, keyword2, keyword3 & gt;"
<meta HTTP - equiv="description" content="This is my page" & gt;
<style type="text/css">
Table {
Border: 2 px # CCCCCC solid;
Width: 360 px;
}
Td, th {
height: 30px;
Border: # CCCCCC 1 px solid;
}
</style>
<body>
Interface form submission jump success & lt; br>
<%
//driver name
String driverName="com. Mysql. JDBC Driver".
//database user name
String userName="root";
//password
String userPasswd="ax191823503";
//database name
String dbName="zhbit";
//table name
String tableName="book";
//connection string
The String url="JDBC: mysql://localhost: 3306/" + dbName + "? Userid="
+ "+ userName & amp; Password="+ userPasswd;
Class.forname (". Com. Mysql. JDBC Driver "). The newInstance ();
The Connection Connection=DriverManager. GetConnection (url);
Statement statement=connection.createStatement();
String SQL="SELECT * FROM" + tableName;
The ResultSet rs=statement. ExecuteQuery (SQL);
% & gt;
<%
Out. Print (" books number ");
% & gt;
<%
Out. Print (" title ");
% & gt;
<%
Out. Print (" author ");
% & gt;
<%
Out. Print (" categories ");
% & gt;
<%
Out. Print (" number ");
% & gt;
<%
Out. Print (" price ");
% & gt;
<%
While (rs), next ()) {
% & gt;
<%
Out. Print (rs) get string (1));
% & gt;
<%
Out. Print (rs) get string (2));
% & gt;
<%
Out. Print (rs. Get string (3));
% & gt;
<%
Out. Print (rs. Get string (4));
% & gt;
<%
Out. Print (rs. Get string (5));
% & gt;
<%
Out. Print (rs. Get string (6));
% & gt;
<%
}
% & gt;
<%
Out. Print (" has shelves of books information as above - ");
% & gt;