简单页面数据输不出来

gaojupeng 2006-02-13 03:58:58
数据输不出来,帮忙给看看,谢谢了
程序如下:
<%@page contentType="text/html; charset=gb2312"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*"%>
<%@page import="java.sql.*"%>
<html>
<head>
<title>登录页面</title>
</head>
<body bgcolor="lavender">
<%String name="";%>
<%String pass="";%>
<%name=request.getParameter("username");%>
<%pass=request.getParameter("mima");%>
<%=name%>
<%=pass%>
<%String url = "jdbc:odbc:zhuce"; %>
<%String subS="select * from users where LogID='"+name+"' and LogPw='"+pass+"' ";%>
<%=subS%>
<%try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection(url,"","");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(subS);
while(rs.next())
{%>
<%=rs.getString("LogID")%>
<p>
<%=rs.getString("LogPw")%>
<%}%>
<%rs.close();stmt.close();con.close();}
catch(Exception e){
System.out.println(e);}%>
<hr>
</body>
</html>
...全文
65 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zeq258 2006-02-13
  • 打赏
  • 举报
回复
好乱的代码,

建议,不要急着做程序,

先找些编程规范的资料看下!
gaojupeng 2006-02-13
  • 打赏
  • 举报
回复
页面没有输出错误信息,
我试试“rs.close();stmt.close();con.close();应该放到finally{}中去”
Camelh 2006-02-13
  • 打赏
  • 举报
回复
错误信息呢???
rs.close();stmt.close();con.close();应该放到finally{}中去

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧