Controller.java爲什麼我的控制器中的地圖總是返回一個nullpointerexception?
Map<String, String[]> formData = request().body().asFormUrlEncoded();
if(formData.get("firstName") != null) {
JOptionPane.showMessageDialog(null, "not null");
}
當我點擊保存按鈕,我運行程序後,它總是返回,即使我在的firstName文本框把價值NullPointerException
錯誤消息。
我看了你的問題,因爲「這是可能會或可能不會涉及到,我不是想給你的錯誤消息的一些隨機碼。」 – John3136
可能你需要閱讀這個http://stackoverflow.com/questions/271526/avoiding-null-statements –
上面的代碼是我的代碼試圖通過地圖獲取文本框的值。我每次得到的錯誤是NullPointerException。 –