Home  >  Article  >  Backend Development  >  Int type input directly submits data as 0 instead of empty

Int type input directly submits data as 0 instead of empty

WBOY
WBOYOriginal
2016-09-08 08:43:512047browse

Int type input directly submits data as 0 instead of empty

The form has two database inputs of type int. If the data is submitted directly to the database, it will be 0 instead of empty.
The default value of the database is empty, not 0. But the effect I want is empty. How to solve it? Please give me some guidance. Thank you very much

Reply content:

Int type input directly submits data as 0 instead of empty

The form has two database inputs of type int. If the data is submitted directly to the database, it will be 0 instead of empty.
The default value of the database is empty, not 0. But the effect I want is empty. How to solve it? Please give me some guidance. Thank you very much

Use empty to detect whether the variable is empty, and then reassign the '' character. When inserted into the database, it will be empty.

java is so clearly divided, the front end is all strings. You can try rewriting the set method of the corresponding field of bean

The default value of this field in the database is set to 0. If no default value is given, it will be null

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn