X
xiaotianwangzi
Unregistered / Unconfirmed
GUEST, unregistred user!
为什么不能打印出值
<%@page contentType="text/html;charset=gb2312"%>
<%@page language="java" import="java.sql.*" %>
<HTML>
<HEAD><font size=6 align="center">登录界面</font>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=GB2312">
</head>
<body bgcolor="#ccccff">
<%!
String xm2;
String password;
String xm1;
String nl;
String zhw;
String mm;
String sql;
%>
<%
password=request.getParameter("ps");
xm2=request.getParameter("xingming");
sql="select * from zgjbxx where xm='"+xm2+"'and mm='"+password+"'";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbcdbc:hyg");
Statement ss=con.createStatement();
ResultSet rs=ss.executeQuery(sql);
%>
<% while(rs.next())
{
xm1=rs.getString("xm");
nl=rs.getString("nl");
zhw=rs.getString("zhw");
mm=rs.getString("mm");
}
%>
<table>
<tr>
<td>姓名:<%=xm1%></td>
</tr>
<tr><td>
年龄:<%=nl%>
</td></tr>
<tr><td>
职务:<%=zhw%>
</td>
</tr>
</table>
</body>
</html>
<%@page contentType="text/html;charset=gb2312"%>
<%@page language="java" import="java.sql.*" %>
<HTML>
<HEAD><font size=6 align="center">登录界面</font>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=GB2312">
</head>
<body bgcolor="#ccccff">
<%!
String xm2;
String password;
String xm1;
String nl;
String zhw;
String mm;
String sql;
%>
<%
password=request.getParameter("ps");
xm2=request.getParameter("xingming");
sql="select * from zgjbxx where xm='"+xm2+"'and mm='"+password+"'";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbcdbc:hyg");
Statement ss=con.createStatement();
ResultSet rs=ss.executeQuery(sql);
%>
<% while(rs.next())
{
xm1=rs.getString("xm");
nl=rs.getString("nl");
zhw=rs.getString("zhw");
mm=rs.getString("mm");
}
%>
<table>
<tr>
<td>姓名:<%=xm1%></td>
</tr>
<tr><td>
年龄:<%=nl%>
</td></tr>
<tr><td>
职务:<%=zhw%>
</td>
</tr>
</table>
</body>
</html>