2017-08-10 75 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方法上未賦值的變量。

相關問題