前台不输入,如何让后台获取到的是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