[JAVA] Form that receives the value of the repeating item in Spring MVC

It seems that you can also receive it with String [], but if you implement it with lazyList, it will be convenient to handle like PHP, right? That is.

SampleForm.java


public class SampleForm {
    private List<String> valueList = ListUtils.lazyList(new ArrayList(), new Factory() {
        public Object create() {
            return new String();
        }
    });

    public List<String> getValueList() {
        return valueList;
    }

    public void setValueList(List<String> valueList) {
        this.valueList = valueList;
    }
}

sample.jsp


<form:input path="valueList[0]"/>
<form:input path="valueList[1]"/>
<form:input path="valueList[2]"/>

Recommended Posts

Form that receives the value of the repeating item in Spring MVC
Determine that the value is a multiple of 〇 in Ruby
Spring validation was important in the order of Form and BindingResult
Procedure to make the value of the property file visible in Spring Boot
Sample program that returns the hash value of a file in Java
The official name of Spring MVC is Spring Web MVC
Get multiple Resources that match the pattern in spring
[For beginners] DI ~ The basics of DI and DI in Spring ~
Test the response JSON of the REST API created in Spring MVC using AssertJ in MockMvc
Find the approximate value of log (1 + x) in Swift
Branch processing by the return value of RestTemplate and the status code of ResponseEntity in Spring Boot
Put the file in the properties of string in spring xml configuration
Accelerate testing of Validators that require DI in Spring Boot
A program that counts the number of words in a List
Sample code that uses the Mustache template engine in Spring Boot
Get a proxy instance of the component itself in Spring Boot
{The first consecutive 10-digit prime number in the value of e} .com
Problem that the attribute of User model becomes nil in ActionMailer
I want to change the value of Attribute in Selenium of Ruby
How to increment the value of Map in one line in Java
[Spring Boot] List of validation rules that can be used in the property file for error messages
This and that of the JDK
Order of processing in the program
Filter the result of BindingResult [Spring]
Number of digits in numeric item
The problem that the contents of params are completely displayed in the [Rails] view
[Rails / simple_format] Helper method that reflects line breaks entered in the form
This and that of the implementation of date judgment within the period in Java
How to get the setting value (property value) from the database in Spring Framework
How to change the value of a variable at a breakpoint in intelliJ
Android development, how to check null in the value of JSON object
Get the value of enum saved in DB by Rails with attribute_before_type_cast