jsp页面空指针 5

<%@pageimport="java.sql.*"%><%@pagecontentType="text/html"pageEncoding="UTF-8"%><html... <%@ page import="java.sql.*"%>
<%@ page contentType="text/html" pageEncoding="UTF-8"%>

<html>
<head>
<title>数据处理页面</title>
<meta http-equiv="Content-type" content="text/html" charset=UTF-8>

</head>
<body bgcolor="cccfff">
<%
String userName = request.getParameter("userName");
byte b1[] = userName.getBytes("ISO-8859-1");
userName = new String(b1, "UTF-8");
String password = request.getParameter("password");
byte b2[] = password.getBytes("ISO-8859-1");
password = new String(b2, "UTF-8");
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
if (userName.equals("")) {
response.sendRedirect("login.jsp");
}
try {
String url = "jdbc:odbc:ch06";
String user = "sa";
String password1 = "root";
conn = DriverManager.getConnection(url, user, password1);
stmt = conn.createStatement();
String sql = "select * from user where userName='" + userName
+ "'";
rs = stmt.executeQuery(sql);
if (rs.next()) {
String sql1 = "select * from user where password='"
+ password + "'";
rs = stmt.executeQuery(sql1);
if (rs.next()) {
response.sendRedirect("index.jsp");
} else {
response.sendRedirect("login.jsp");
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
rs.close();
stmt.close();
conn.close();
}
%>
</body>
</html>
展开
 我来答
uwqey
2013-05-22 · TA获得超过101个赞
知道小有建树答主
回答量:320
采纳率:0%
帮助的人:104万
展开全部
报哪一行空指针呀?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式