Add a new item to the list box printed on the 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 am printing voceMenuList on jsp page using Spring form tag to be able to change values

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

      

On the same jsp page, I would like to allow the user to add a new VoceMenu. But in this case, I cannot figure out what to write inside the attribute path

.

+3
java spring-mvc jsp jstl


source to share


No one has answered this question yet

See similar questions:

1
How to set up list objects for modeling by form (<form: input> tag)

or similar:

697
How to create a new list in Java
ten
Iterating through list object in JSP
1
Spring Framework JSP Form Handling: @ModelAttribute
1
Spring: printing variables in jsp page
0
spring jsp error
0
Spring response json onload jsp
0
Can't print JSP from spring controller, but print result to console
0
Spring MVC 5 & Tomcat 9 - Cannot render model attribute in JSP
0
Send complexe object to controller using @ModelAttribute with spring mvc
0
JSP page not working with spring



All Articles
Loading...
X
Show
Funny
Dev
Pics