当前位置: 代码迷 >> Java Web开发 >> 啊 ResultSet rs=SqlBean.executeQuery(sql1);赋值不上
  详细解决方案

啊 ResultSet rs=SqlBean.executeQuery(sql1);赋值不上

热度:260   发布时间:2016-04-17 11:05:14.0
高手指点啊!!! ResultSet rs=SqlBean.executeQuery(sql1);赋值不上啊
这是代码:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page contentType="text/html; charset=gb2312"%>
<%@ page language="java" import="java.sql.*,mypackage.*"%>
<jsp:useBean id="SqlBean" scope="page" class="mypackage.SQLServerConnBean"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>2列左侧固定右侧自适应宽度+头部+尾部——<a href="http://www.aa25.cn">标准之路www.aa25.cn</a></title>
<link href="layout.css" rel="stylesheet" type="text/css" />
<meta name="Keywords" content="标准之路,www.aa25.cn,网页标准布局,DIV+CSS" />
<meta name="" content="标准之路,www.aa25.cn,网页标准布局,DIV+CSS" />
<meta name="author" content"×××,有问题请到www.68css.cn网站留言" />
<meta name="Description" content="本套网页标准布局模板是由标准之路(www.aa25.cn)制作完成,如果您要转载,请保留版权" />
</head>

<body>
<div id="container">
  <div id="header">
  <div align="center">
  <table width="453" height="92" border="0">
  <tr>
  <td width="447">政法学院成绩查询</td>
  </tr>
  </table>
  </div>
  </div>
  <div id="mainContent">
  <div id="sidebar">
  <table width="200" height="211" border="0">
  <tr>
  <td>
<p>&nbsp;</p>
  <p>
  <%  
  String id=request.getParameter("textfield");
String pw =request.getParameter("textfield2");
String sf=request.getParameter("radiobutton");
if("t".equals(sf))
{
String sql = "select * from teacher where teano='"+id+"' and pwt='"+pw+"'";
SqlBean.OpenConn();
  ResultSet rs=SqlBean.executeQuery(sql);
  //如果记录集非空,表明有匹配的用户名和密码,登陆成功
  if ( rs.next())
 
  {
session.setAttribute("id",id);
response.sendRedirect("teacher.jsp");
}
  else
{
response.sendRedirect("/loginwrong.jsp");
}
  }
else
{
String sql1 = "select * from student where sno='" + id + "' and pw= '" + pw + "'"; 
SqlBean.OpenConn();

ResultSet rs=SqlBean.executeQuery(sql1);
if ( rs.next ( ) )
{
session.setAttribute("id",id);
response.sendRedirect("stu/students.jsp");
}
 else
{
response.sendRedirect("/loginwrong.jsp");
}
  }
%>
</body>
</html>
这是报错信息:
 Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Tue Sep 26 09:49:03 CST 2017
  • 最近登录:Tue Sep 26 09:49:03 CST 2017
  • 最近登录:Tue Sep 26 09:49:03 CST 2017
  • 最近登录:Tue Sep 26 09:49:03 CST 2017
  • 最近登录:Tue Sep 26 09:49:03 CST 2017