Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

Posts: 1
  • Mark post as helpful
  • send pies
  • 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):


JSP form:

[Thumbnail for scren.jpg]
Posts: 1170
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
  • 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:
I've been selected to go to the moon! All thanks to this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic