Reputation: 475
I am new to Thymeleaf and HTML5.
I have a variable order number
of data type long
.
There is an input text field in the HTML for searching order number (assigned to order number
variable), which always initialise to zero everytime when we load the HTML page.
Also, I am getting the error when I manually empty the filed and submit the form to fetch record from database.
My requirement is to have this field empty because this is an optional field. It can be zero/null/doesn’t contain any value.
Sample Code Snippet: <input type=“text” th:field=${order.ordernumber}>
Please advise on how to get this order number variable (long
data type) without any default value being set.
Upvotes: 1
Views: 1490
Reputation: 7309
It depends on your model. If there is 0
and this is the default for long
this will shown in the view. If the ordernumber can be null or empty you should use Long
.
This is only an assumption. To give you a detailed answer you must provide more information.
Upvotes: 1