日期:2014-05-18  浏览次数:20744 次

数据库数据输出为空白
代码是这样的:
<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   import= "java.sql.* "   errorPage= " "   %>
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 无标题文档 </title>
</head>

<body>
<%
final   String   DBDRIVER   =   "com.microsoft.jdbc.sqlserver.SQLServerDriver "   ;  
final   String   DBURL   =   "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=myjob ";
response.setCharacterEncoding( "GBK ");
Connection   conn   =   null   ;  
ResultSet   rs   =   null   ;  
String   name=null;
String   password=null;
String   user= "sa ";
String   pass= " ";
//String   name1=new   String(request.getParameter( "name ").getBytes( "ISO8859_1 ")).trim();
Statement   st=null;
PreparedStatement   stat=null;
boolean   flag=true;
Class.forName(DBDRIVER)   ;  
conn   =   DriverManager.getConnection(DBURL,user,pass)   ;  
st=conn.createStatement();
rs   =   st.executeQuery( "select   email   from   user1   where   name= '11 ' "   )   ;  
rs.close();                
conn.close();  
%>
<table   width= "100% "   height= "400 "   border= "1 ">
    <tr>
        <td> <jsp:include   page= "update.jsp "   flush= "true "> </jsp:include> </td>
        <td> <table   width= "100% "   height= "81% "   border= "1 ">
            <tr>
                <td> &nbsp; </td>
            </tr>
            <tr>
                <td> <table   width= "200 "   border= "1 ">
                    <tr>
                        <td> 用户名 </td>
                        <td> <%=rs.getString( "email ")%> </td>
                    </tr>
                    <tr>
                        <td> 联系电话 </td>
                        <td> &nbsp; </td>
                    </tr>
                    <tr>