• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Spring Boot save List from JSP form to db (OneToMany)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I need help. I have Spring Boot app One to Many.And I need help with sending list from model jsp form and save to db. So I need Simultaneously save to db two Model tables (One To Many) from jsp form (using Model Attribute):





Controller:



JSP form:

scren.jpg
[Thumbnail for scren.jpg]
 
Rancher
Posts: 1171
18
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They're a cople of thing wrong, you get the main idea, but missed out at the excecution.
In your jsp you import the taglib prefix, but you don't use it.
your form should look something like this:

In your getmethod from your controller you have to bind your form to your entity, like:

and finally you use your post method to save it, like this:
 
reply
    Bookmark Topic Watch Topic
  • New Topic