Add a new item to a List printed in a jsp page using Spring form:input

I have a class called Menu. It has a List of objects called VoceMenu

public class Menu implements Serializable{
    private List<VoceMenu> voceMenuList;
}

public class VoceMenu implements Serializable{  
    private String descrizione; 
}

I print voceMenuList in a jsp page using Spring form tag, to be able to modify the values

...
<form:form modelAttribute="menu">       
   <c:forEach items="${menu.voceMenuList}" varStatus="counter">         
        id<form:input path="voceMenuList[${counter.index}].descrizione"/>
...

In the same jsp page, I’d like to allow user to add a new VoceMenu. But, in this scenario, I can’t understand what to write inside the path attribute.


Source: jsp

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.