在*DAO中写了这样一个方法
public boolean get(String id, String password, String amount, String vdate) {
Connection con = dbc.getcon();
try {
PreparedStatement pstat = con
.prepareStatement("insert into get values('" + id + "','"
+ password + "','" + amount + "','" + vdate + "')");
int count = pstat.executeUpdate(); if (count > 0) {
issuc = true;
} pstat.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} return issuc;
}在action类中调用它
public String get(){ 
    dao.get(account.getId(),account.getPassword(),account.getAmount(),account.getVdate());
    return SUCCESS;
}参数通过jsp页面传的报错java.lang.NullPointerException ,不知道怎么回事

解决方案 »

  1.   

    杀了个花,account对象?还是dao对象是null?
      

  2.   

    你在get方法里,定义下boolean issuc=false;
    在action里你的get方法有返回值的,试试这样;
    if(dao.get(account.getId(),account.getPassword(),account.getAmount(),account.getVdate()){
    return SUCCESS;
    }return INPUT;
    试试
      

  3.   

     代码不全也不知道你那里报控值针,我只能说下可能传值过程,你自己看
      先保证你jsp都有传值过来,并且表单里的属性要跟account类里的属性,名称要一个样;
      然后你要保证在这个action里
      定义了private Account account;
      并生成了set ,get 的方法;
      这时account里才有值;
      dao.get(account.getId(),account.getPassword(),account.getAmount(),account.getVdate())//这里看下account是否有值;
      
      

  4.   

    java.lang.NullPointerException 其实只要debug一下就知道错误的所在了 直接看consle的异常中出现的你的代码的类就行了 其实很简单,这种问题如果自己都解决不了 那就悲催了!