2017-08-10 77 views
-1

我在运行我的代码时总是收到这个异常。java.lang.NullPointerException当我从jsp发送数据到servlet时

  if((UDID)!=null && action.equalsIgnoreCase("insert")){ // null pointer exception 
      int id = Integer.parseInt(UDID); 
      UserBean user = new UserBean(); 
      user.setUserdetailid(id); 
      user.setUserid(id); 

+1

action is null? –

+0

可能的重复[什么是NullPointerException,以及如何解决它?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it ) – litelite

+0

“行动”分配在哪里? –

回答

0

声明:

action.equalsIgnoreCase("insert") 

将抛出一个NullPointerException如果动作== null,因为你不能叫equalsIgnoreCase方法上未赋值的变量。

相关问题