The program reports no errors but cannot write to the database

I tossed all night today, and I can’t figure out why the data passed in from the front end with EL expressions is tested in all aspects. QueryRunner's update (sql, params) method is allowed to report without any error, but the data cannot be modified.
I later discovered that I had an incoming value with spaces. Although we usually use spaces in the database visual editor, it doesn’t matter how many spaces are separated, but when the value of params contains spaces, it is equivalent to

update table set name='张三' where id='    1234'

When the id of **" 1234"** is not found, it will not be modified successfully, and of course no error will be reported.
I set it in a label

value="   ${user.SID} "

Of course, I didn't type so many spaces, I just typed one. I deliberately typed a few more to make everyone see clearly.
The correct one should be

value="${user.SID}"

No spaces inside double quotes! ! ! !

to sum up

When encountering a database update operation, there is no error, and no statement error, pay attention to whether there are spaces in the value in the filter condition!

Guess you like

Origin blog.csdn.net/interestANd/article/details/111244370