-----1.jsp
<%@ page import="common.DataBase"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%
DataBase db = new DataBase();
ResultSet rs1 =null;
db.setDbname("cms");
db.setIpaddr("192.168.0.1");
db.setUser("root");
db.setPassword("111111");
db.DbCon();
rs1=db.Getresultset("select name from tbl_user");
%><%=rs1.getString(1)%>
<% }
%>
</body>
</html>
<body>
<%
DataBase db = new DataBase();
ResultSet rs1 =null;
db.setDbname("cms");
db.setIpaddr("192.168.0.1");
db.setUser("root");
db.setPassword("111111");
db.DbCon();
rs1=db.Getresultset("select name from tbl_user");
%><%=rs1.getString(1)%>
<% }
%>
</body>
</html>
转载于:https://blog.51cto.com/hikvisionx/510096