<%@ page language = "java" contentType = "text/ html Charset=iso-8859-1 "
pageencoding="iso-8859-1"%>
<! DOCTYPE html public "-//w3c//dtd HTML 4.01 transitional//en " "/ http Www.w3.org/TR/html4/loose.dtd ">
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
< Table Border="1" width="100%" >
< TR >
<TD width="60" valign="Top" bgcolor="#999999" class="DH"><Div Align="Center">name</Div></TD>
<td Width= " valign" ="Top">< Div Align="left">password<br>
</ div ></ TD Span style= "COLOR: #009193" >>
< TD width = "9" valign = "top" > <!--dwlayoutemptycell-->&NBSP; </ TD >
</TR>
<%
Request.setcharacterencoding ("gb2312");
Java.sql.Connection conn = drivermanager.getconnection ("Jdbc:mysql://localhost:3306/gpsdatabase"," Root "," 123456 ");
String sql1="Select*from user_table";
Statement statemenet = (Statement) conn.createstatement ();
ResultSet rs1 = Statemenet.executequery (SQL1);
while (Rs1.next ()) {
%>
< TR >
<TD width=" the" valign="Top" bgcolor="#999999" class="DH"><Div Align="Center"><span class="Style8"><%=Rs1.getstring ("Email")%>"</span></Div></TD>
<TD width=" the" valign="Top"><Div Align="left"><span class="Style8"><%=Rs1.getstring ("Password")%></span><BR>
</ div ></ td >
< td width = "9" Span style= "COLOR: #932192" >valign = <!--dwlayoutemptycell--> </ TD >
</ TR >
<%
} rs1.close ();
%>
</table>
How does JSP fetch data from a database and display it on a table