Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 java.lang.NullPointerException怎么解决
liujing319





发贴: 17
于 2005-09-06 12:06 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我的JSP出现下面的错误:请各位帮忙看看
exception

org.apache.jasper.JasperException
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
  org.apache.jsp.liangdichaxun_jsp._jspService(liangdichaxun_jsp.java:100)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
怎么回事?我的JSP 代码如下

<%@ include file="head.jsp"%>

<form action="liangdichaxun.jsp" method="post">
<input type="text" name="qishidi">
<input type="text" name="mudidi">
<input type="submit" value="chaxun">
<%


String qishi,mudi;
int p=2;
String qishidi= new String (request.getParameter("qishidi").getBytes("ISO-8859-1"),"GBK");
String mudidi= new String (request.getParameter("mudidi").getBytes("ISO-8859-1"),"GBK");
qishi=request.getParameter("qishidi");
mudi=request.getParameter("mudidi");
out.print(qishidi);
out.print(mudidi);
find.setQishi(qishi);
find.setMudi(mudi);


if(qishi!=null&&!qishi.equals("")&&mudi!=null&&!mudi.equals(""))
   {
   find.setKindCamera;
   ResultSet rs=find.execute();
   if(rs.next ())
     out.print(rs.getString(1));
   }
%>
</form>
<%@ include file="tail.jsp"%>

我的BEAN 如下

package chaxun;
import util.data;
import java.sql.*;

public class find {
  private int kind;
  data sqlbean=new data();
  String sql;
  String checi;
  String qishi;
  String mudi;
  
  public find(){
    kind=0;
    sql="";
    
  }
  public void setKind(int k){
    kind=k;
  }
  public int getKind(){
    return kind;
  }
  public void setCheci(String che){
    checi=che;
  }
  public String getCheci(){
    return checi;
  }
  public void setQishi(String qi){
    qishi=qi;
  }
  public String getQishi(){
    return qishi;
  }
  public void setMudi(String mu){
    mudi=mu;
  }
  public String getMudi(){
    return mudi;
  }
  public String getSql(){
    int m=getKind();
    qishi=getQishi();
    mudi=getMudi();
    checi=getCheci();
    switchMusic
    {
      case 1:sql="select * from jibenbiao where checi='"+checi+
   "'";
      break;
      case 2:sql="select xiangxi1.checi from xiangxi1,xiangxi2 where xiangxi1.zhanming='"+qishi
      +"' and xiangxi2.zhanming='"+mudi+"'and xiangxi1.checi=xiangxi2.checi";
  
      break;
    }
  
    return sql;
  }
    public ResultSet execute(){
      
      
      ResultSet rs=sqlbean.executeQuery(getSql());
      
      
      
      
      return rs;
      
      
    
  
      
      
    }
  
    
    public static void main(String []args){
      }




[转帖]面向对象的思维方法

话题树型展开
人气 标题 作者 字数 发贴时间
1752 java.lang.NullPointerException怎么解决 liujing319 3046 2005-09-06 12:06
1516 Re:java.lang.NullPointerException怎么解决 chengbd 27 2005-09-07 00:19

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923