我一直在試圖從here修改JSP下面的代碼:幫助的NullPointerException錯誤
ArrayList arrayList=new ArrayList();
String = "tagToFind";
Node n = node.getParentNode();
String printOut = "";
while (n != null && !n.getNodeName().equals(tagToFind)) {
n = n.getParentNode();
}
if (n.getNodeValue() != null){
arrayList.add(n.getNodeValue());
}
在 「如果(!n.getNodeValue()= NULL){」 行,我收到了「 NullPointerException「錯誤。我不明白爲什麼我得到這個錯誤,因爲我試圖測試Null並跳過它們。
任何人都可以幫我解決這個問題嗎?