Spring MVC how to process form with the date?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
17 views
Good time!

Writing a project in Spring MVC stalled on the parsing date. At the front there is a form, for example:
5be20b18ac95e072738380.png

Her data is read into the controller, the controller writes to the database (via dao) using Hibernate. Can not quite get how to parse the date because a string is passed, and stored Date. Explain on fingers, please, how to do it and what happens, or stick to the suitable example. Examples looked different, understanding does not come. Thank you.

UPD: Actually I'd be glad of any information on the interaction of the front with buck, swimming in this subject.
by | 17 views

2 Answers

0 like 0 dislike
I take it you did enter the date in 3 fields... Usually, doing one field and this field js to hang libo for water dates, for example JQuery Datepicker, and in the controller do everything that is written azerphoenix above
by
0 like 0 dislike
https://gerrytan.wordpress.com/2013/05/21/binding-...
I learning Spring MVC and have not yet encountered with sending Date from the form, but see the link above.
As I understand it you have @Entity and must specify the annotation @DateTimeFormat

Code example:
@DateTimeFormat(pattern = "dd/MM/yyyy") private Date dob;


public String addCustomer(@ModelAttribute("addCustomerForm") AddCustomerForm form) { // do something with the form input .. }


Or, another example https://stackoverflow.com/questions/43786382/submi...
to retrieve data from a form with input{type="date"}
by

Related questions

0 like 0 dislike
1 answer
asked Mar 26, 2019 by palebluedot
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
35,389 users