0

In my front end, I am allowing user to create and save multiple number of entries to a table at the same time.

For now i am sending this input to Java class in form of string which i am creating at the time of save. But if table size is very very big (eg. 400-500 entries), then creating string is a time taking process.

Is the any other solution for this??

Thanks in advance.

user2794034
  • 71
  • 1
  • 8

1 Answers1

0

Send them as a List.

In Action:

private List<String> myList;

/* GETTER AND SETTER */

In JSP, handle a counter, and each time the user create a new row, use it to index the row:

<input type="text" name="myList[0]" />
<input type="text" name="myList[1]" />
<input type="text" name="myList[2]" />

and next time the user will create an entry, it will be

<input type="text" name="myList[3]" />

If the user creates the entries from, let's say, a popup or a modal dialog, and they won't be editable after having been created, then generate an <input type="hidden" /> field along with a <span> (or whatever):

<input type="hidden" name="myList[3]" value="lastValueEnteredByUser" />
<span>lastValueEnteredByUser</span>
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243