There is no input value in the input box on the jsp page. If you submit it directly, is it null or not? ? ?

When writing the registration function test empty registration when I was working on the project today, I had first performed the empty registration operation on the data, but during the test, I found that the empty registration can also be successfully registered to the database once. At this time, I just Realized that it might be that the default value of the input box is not null, so I printed the default value and found an empty thing. Is it a carriage return and line feed? The test "\r\n" is not true. As a result, I tried the "" empty string, and the result was haha. . .
Conclusion: There is no input value in the input box on the jsp page, and the "" empty string is obtained. (Roughly speaking) If the data transmitted from the background is empty, it is null. If it is directly obtained on the page without going through the background, the data is empty, then it is ""
Principle: request.parameter is essentially a map, if there is no myinput parameter or If the parameter value is null, return null. If there is this parameter and the value is an empty string, an empty string is returned.

Guess you like

Origin blog.csdn.net/xiaole060901/article/details/109270255