如何在登陆成功的界面显示出该用户注册时的部分信息?
这是我自己写的代码,但存在错误?望各位大神帮帮.
<%@page import="java.sql.*"%>
<%@ page contentType="text/html;charset=utf-8" %>
<%@ page import="ch2.service.UserService" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用户登录</title>
</head>
<body >
<center>
<%
String uid=request.getParameter("uid");
String password=request.getParameter("password");
UserService userService=new UserService();
if(userService.login(uid,password)){
session.setAttribute("uid",uid);
%>
<font color="blue">登录成功!</font>
<%Class.forName("com.mysql.jdbc.Driver").newInstance();
String url ="jdbc:mysql://localhost/userdb?user=root&password=123456&useUnicode=true&characterEncoding=gbk";
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select uid,realName,gender,profession,tel,loginNum";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%><table width="40%" border="1" align="center" cellpadding="2" cellspacing="0" >
<caption>
<font color="black" style="font-size: 20px"><FONT color=yellow>个人的基本信息</FONT></font><br></caption>
<tr bgcolor="white">
<td width="50%" align="center">用户名</td>
<td width="50%" align="center" >
<%out.print (rs.getString(1));%></td>
</tr>
<tr bgcolor="white">
<td width="50%" align="center">真实姓名</td>
<td width="50%" align="center" >
<% out.print (rs.getString(2));%>
<tr bgcolor="white">
<td width="50%" align="center">性别</td>
<td width="50%" align="center" >
<%if(rs.getInt(3)==1)
out.print ("男");
else
out.print ("女");%></td>
</tr>
<tr bgcolor="white">
<td width="50%" align="center">职业</td>
<td width="50%" align="center" >
<% if(rs.getInt(4)==1)
out.print ("医生");
else
out.print ("病人");%>
</tr>
<tr bgcolor="white">
<td width="50%" align="center">电话</td>
<td width="50%" align="center" >
<% out.print (rs.getString(5));%>
<tr bgcolor="white">
<td width="50%" align="center">登陆次数</td>
<td width="50%" align="center" >
<%out.print (rs.getString(6));%></td>
</tr>
</table><br>
<%}%>
<%}else{ %>
<font color="red">用户名或密码错误!</font>
<a href="#" onclick="history.back();">返回</a>
</center>
</body>
</html
<%}%>
>