0

I'm new to Spring MVC and I'm creating a form with several attributes that the user needs to complete and I want to store a list of numbers into an Array and not create a variable for each field

enter image description here

I try this code, but doesn't work :

Linea 1 <form:input type="number" path="numberArray[0]"/>
Linea 2 <form:input type="number" path="numberArray[1]"/>
...
1
  • Please add your complete codes Commented Jan 10, 2017 at 23:37

1 Answer 1

1

In Spring 3+, <form:input/> cannot be used for this because the W3C HTML Specification changed to disallow [] in form input name attributes. Here is a good writeup of using the raw HTML input elements to support rows/arrays of fields (it's essentially what you were trying to do with numberArray[index] but using the raw HTML input element).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.