type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Exception in JSP: /biyesheji/chakan1.jsp:8986:    ResultSet rs=null;
87:   
88:    String str=request.getParameter("id");
89:    byte b[]=str.getBytes("ISO-8859-1");
90:    str=new String(b);
91:    try{
92:      Class.forName("com.mysql.jdbc.Driver");
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause java.lang.NullPointerException
org.apache.jsp.biyesheji.chakan1_jsp._jspService(chakan1_jsp.java:131)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.这到底什么错误?

解决方案 »

  1.   

    88: String str=request.getParameter("id");
    89: byte b[]=str.getBytes("ISO-8859-1");java.lang.NullPointerException
    org.apache.jsp.biyesheji.chakan1_jsp._jspService(chakan1_jsp.java:131)这个str为null吧。参数没传过来?
      

  2.   

    以下是代码:
    <%
      Connection conn=null;
      Statement stmt=null;
      ResultSet rs=null;
     
      String str=request.getParameter("id");
      byte b[]=str.getBytes("ISO-8859-1");
      str=new String(b);
      try{
        Class.forName("com.mysql.jdbc.Driver");
      }
      catch(ClassNotFoundException ce){
        out.println(ce.getMessage());
      }
      
      if(str==null)str="1";
      try{
        conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/job","root","123");
    stmt=conn.createStatement();
    rs=stmt.executeQuery("SELECT*FROM apply_inf where s_name='"+str+"'");

    while(rs.next()){
       out.print("<br>姓名:"+rs.getString("s_name"));
       out.print("<br>性别:"+rs.getString("sex"));
       out.print("<br>专业:"+rs.getString("major"));
       out.print("<br>学历:"+rs.getString("edu_bg"));
       out.print("<br>应聘职位:"+rs.getString("apply_for"));
       out.print("<br>-------------------------------------------");
    }
    %>
                </p>
                <p align="justify">                  <span class="style5"><a href="shoucangjia.jsp">返回</a></span>
    <%

     }
     catch(SQLException e){
        System.out.println(e.getMessage());
     }
     finally{
        stmt.close();
    conn.close();
     }
     %>是id的没传过来吧    
      

  3.   

    byte b[]=str.getBytes("ISO-8859-1");
    str如果为null,就会出错啊。很明显的问题。
      

  4.   

    把if(str==null)str="1";
    放到byte b[]=str.getBytes("ISO-8859-1");的前一行即可。