<% @ page language = " java " contentType = " text/html; charset=gb2312 " pageEncoding = " gb2312 " %> <% @ page language = " java " %> <% @ page import = " java.sql.* " %> <! DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN " > < html > < head > < title > get max ordertime page </ title > </ head > < body > <% // 数据库用户名 String userName = " root " ; // 密码 String userPasswd = " root " ; // 数据库名 String dbName = " wap " ; // 表名 String tableName = " p_order " ; // 联结字符串 String url = " jdbc:mysql://localhost/ " + dbName + " ?user= " + userName + " &password= " + userPasswd;Class.forName( " com.mysql.jdbc.Driver " ).newInstance();Connection connection = DriverManager.getConnection(url);Statement statement = connection.createStatement();String sql = " SELECT max(ordertime) FROM " + tableName;ResultSet rs = statement.executeQuery(sql); while (rs.next()) ... {%><%=rs.getString(1)%><%} rs.close(); statement.close(); connection.close(); %> </ body > </ html >