<%@ page contentType="text/html;charset=GB2312"%>
<%@ page language="java" import="java.sql.*"%>
<%
String MySQL(和PHP搭配之最佳組合)Driver = "org.gjt.mm.MySQL(和PHP搭配之最佳組合).Driver";
String url = "jdbc:MySQL(和PHP搭配之最佳組合)://localhost/hq";//數據庫連接
Connection conn;
Class.forName(MySQL(和PHP搭配之最佳組合)Driver);
conn = DriverManager.getConnection( url,"root","");//用戶名與密碼
if(conn==null){
System.out.println("get Conn Error");
}
Statement stmt=conn.createStatement();
ResultSet rs=null;
rs=stmt.executeQuery("select * from news_art");
while(rs.next())
{//循環顯示記錄
%>
<a href=display.jsp(SUN企業級應用的首選)?id=<%=rs.getString("id")%> target=_blank><%=rs.getString("title")%></a>(<%=rs.getString("times")%>)
<%="<br>"%>
<%
}
rs.close();
stmt.close();
conn.close();
%>