• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
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:
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic