This week's book giveaway is in the XML and Related Technologies forum.
We're giving away four copies of Java XML & JSON and have Jeff Friesen on-line!
See this thread for details.
Win a copy of Java XML & JSON this week in the XML and Related Technologies 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Json array pass to model through controller [Spring Boot]  RSS feed

 
Greenhorn
Posts: 1
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, How are you?
I have a web project, where I'm fetching a json file through JavaScript for frontend. It's working fine. But when I send those json data to my model, I'm not able to sent them.

   
and



and in my controller,



In model class.


So how can pass json value with variable from one form?
If you want to see my whole project, here is the link. Dropdown
 
Sheriff
Posts: 21601
101
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your models are expected to be a list / array of strings, but your JavaScript code sends them as a single string. From .val():

Get the current value of the first element in the set of matched elements or set the value of every matched element.


To get a list of values, you need to use map.

Untested (but copied from DevDocs):
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
Enterprise Java integration with Delphi and Free Pascal applications - new release 2019.02
https://coderanch.com/t/705708/Enterprise-Java-integration-Delphi-Free
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!