<% @ Page contentType = "text/html; charset = GB2312" %>
<% @ Page language = "java" import = "java. SQL. *" %>
<%
String MySQL (the best combination with PHP) Driver = "org. gjt. mm. MySQL (the best combination with PHP). Driver ";
String url = "jdbc: MySQL (the best combination with PHP): // localhost/hq"; // database connection
Connection conn;
Class. forName (MySQL (the best combination with PHP) Driver );
Conn = DriverManager. getConnection (url, "root", ""); // user name and password
If (conn = null ){
System. out. println ("get Conn Error ");
}
Statement stmt = conn. createStatement ();
ResultSet rs = null;
Rs1_stmt.exe cuteQuery ("select * from news_art ");
While (rs. next ())
{// Display records cyclically
%>
<A href = display. jsp (preferred for SUN Enterprise Applications )? Id = <% = rs. getString ("id") %> target = _ blank> <% = rs. getString ("title") %> </a> (<% = rs. getString ("times") %>)
<% = "<Br>" %>
<%
}
Rs. close ();
Stmt. close ();
Conn. close ();
%>