Editing list using spring JSP input form tag

I recently had to allow the user to edit a list of Strings and was concerned with having to keep track of which Strings were being edited. Spring has made this simple and very clean.

On Form.java, there is a

List<String> ipList;

Within the JSP you add a forEach with an input tag as follows:

<c:forEach var="ip" items="${form.ipList}" varStatus="status">
   <div style="clear: both">
      <form:input path="ipList[${status.index}]"/>
   </div>
</c:forEach>
Advertisements

2 responses to “Editing list using spring JSP input form tag

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s