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:500)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NullPointerException
com.Deal.checkManager(Deal.java:13)
org.apache.jsp.deal_jsp._jspService(deal_jsp.java:76)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.32 logs.
jsp页面:
<form id="form1" name="form1" method="post" action="deal.jsp" onSubmit="return check()">
用户名:
<input name="username" type="text" id="username"/></td>
密 码:
<input type="password" name="password" id="password"/></td>
</tr>
deal.jsp页面
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030" import="java.sql.*" errorPage=""%>
<jsp:useBean id="deal" class="com.Deal" scope="page"/>
<%
String manager=request.getParameter("username");
String pwd=request.getParameter("password");
if(manager!=null&&pwd!=null){
int rtn=deal.checkManager(manager,pwd);
if(rtn==0){
out.println("<script>alert('登录失败!');</script>");
}else{
out.println("<script>alert('登录成功!');</script>");
}
}
%>
deal.java类
package com;
import com.ConnDB;
import java.sql.*;
public class Deal {
public int checkManager(String name,String inpwd) {
int flag = 0;
ConnDB conn=new ConnDB();
String sql = "SELECT * FROM admin where username='" +
name + "'";
ResultSet rs = conn.executeQuery(sql);
try {
if (rs.next()) {
}
}else{
flag = 0;
}
} catch (SQLException ex) {
flag = 0;
}
conn.close();
return flag;
}
}
deal.java类写的不全,但是没有错误,就是字数放不下了
请别复制答案给我,谢谢哈,真需要帮助
我估计问题问题出错是调用包的问题