spring-mvc - Java String The previous line can also output a value, but after entering the if, it becomes a null pointer.
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-17 10:08:18
0
5
501

As shown in the above two pictures, I passed in a decidedDistribute from the front desk. From the output, it can be seen that the decidedDistribute has a value passed in, and the value is still correct when the if statement is judged, but I don’t know why the if function is entered. After the field is entered, it becomes a null pointer, null is output, and a null pointer exception is reported in subsequent calls.
Please explain, thank you

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(5)
漂亮男人

You see the error message and it has already jumped to the Distribute2 method. Why do you still post the content of the Distribute3 method?

Ty80

Call DEBUG to track it

世界只因有你

You add null when judging if, as follows:

if(decidedistribute!=null && "查询".equals(decidedistribute)){
    ...
}

You try it

刘奇

I agree with Xiao Yang vita’s answer. You have found the place where the wrong code reported the error.

In your eclipse or other IDE, set the number of lines of code to display, otherwise you won’t even know where the error code is.
In addition, the stack has printed out which line of which class has the error. You can click on the link to directly Jump to the error reporting location

phpcn_u1582

Found the problem, this is a web project, the second time the null output is actually loaded after the first load and redirection, and the second time no value is passed in, resulting in an error, so the first time the output is successful , I made an oversight and made a mistake. I’m sorry for wasting everyone’s time. Thank you for your help

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template