84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
前台不输入,如何让后台获取到的是null?我想获取null
走同样的路,发现不同的人生
Use js to determine whether the value is empty before submitting. If it is empty, assign null
When submitting, wouldn’t it be enough to remove the name of the empty input?
When you pass the value from the front-end drop-down box to the back-end, if you don't select it, the attribute will be assigned a value of "". You can just judge this on the backend. Normally, the frontend will pass "" for processing
Why must it be null? The default is ""if(x!=null && x!equals("")){
//daima
}
if(x.length>0){ //TODO }
It is recommended to use Google’s guava library which has the emptyToNull method under strings
Check if it is empty and assign null
Use js to determine whether the value is empty before submitting. If it is empty, assign null
When submitting, wouldn’t it be enough to remove the name of the empty input?
When you pass the value from the front-end drop-down box to the back-end, if you don't select it, the attribute will be assigned a value of "". You can just judge this on the backend. Normally, the frontend will pass "" for processing
Why must it be null? The default is ""
if(x!=null && x!equals("")){
}
It is recommended to use Google’s guava library which has the emptyToNull method under strings
Check if it is empty and assign null