Use SQL Server to query the data and display all the data on the page.
<%@ Page Language="Java" Import="Java.util.*"Pageencoding="UTF-8"%><%@pageImport="Jdbc.sqlserver"%><%@pageImport="Java.sql.Connection"%><%@pageImport="Java.sql.Statement"%><%@pageImport="Java.sql.ResultSet"%><%String Path=Request.getcontextpath (); String BasePath=Request.getscheme ()+"://"+Request.getservername ()+":"+Request.getserverport ()+Path+"/";%><! DOCTYPE HTML Public"-//W3c//DTD HTML4.01Transitional//EN "><Html> <Head> <Base href="<%=BasePath%>"> <Title>My JSP'lindao.jsp'Starting page</Title> <Meta HTTP-Equiv="Pragma" content="No-Cache> <Meta HTTP-Equiv=The cache-Control "Content="No-Cache> <Meta HTTP-Equiv="Expires" content="0"> <Meta HTTP-Equiv="keywords" content="Keyword1,keyword2,keyword3"> <Meta HTTP-Equiv="description" Content="This isMy Page "> <!-- <Link rel="Stylesheet" type="text/CSS "href="Styles.css"> --> </Head> <Body> <!--Query Administrator Information -- <Div> <TableBorder=1px style="width:500px;height:200px;text-Align:center;margin:0Auto;margin-Top: 0px "> <div style="Width:500px;height:40px;border:1px Solid Red;margin:0Autotext-Align:center;margin-Top: 60px;background: #fff; margin-Top:-2px "> <Font Color="Red" font-Weight="Bold">Administrator Information</Font> </Div> <TR Style="Background:red"> <Td>Number</Td> <Td>Name</Td> <Td>Number of Ingot</Td> <Td>Delete</Td> </Tr> <% //Reference Connection database method SQL Server SQ1=new SQL Server (); //Get database connection Connection Con1=sq1.getconnection (); //Write SQL statement String SQL1="Select * fromAdmin "; //get Database object operations Statement ST1=con1.createstatement (); //get the results of the query ResultSet rs1=st1.executequery (SQL1); while(Rs1.Next()){ %> <Tr> <Td> <%Out.Print(Rs1.getint (1)+"\ t");%></Td> <Td> <%Out.Print(Rs1.getstring (2)+"\ t");%></Td> <Td> <%Out.println (Rs1.getint (3)+"\ t");%></Td> <Td> <a href="Time.jsp?id=<%Out.Print(Rs1.getint (1)+"\ t");%>">Delete</A></Td> </Tr><% } //frees the resource sq1. Shifang (Rs1,st1,con1); %> </Table> </Div> </Body></Html>
Queries all data with SQL Server and displays