java - Get Key-Value pairs in SimpleFormController from HTML table generated by jsp -
i have jsp page html table. table has 2 colums key-value. value input
field , can changed user.
<table> <tr> <td>key</td> <td>value</td> </tr> <tr> <td>property1</td> <td><input value="value1"/></td> </tr> <tr> <td>property2</td> <td><input value="value2"/></td> </tr> <!-- etc... --> </table>
when submitting form onsubmit
of simpleformcontroller
triggered. here want to retrieve key-value pairs. preferably in map.
i know how select parameters request through name
attribute using getparameter()
. don't see how can map keys corresponding values using name
attribute.
@override protected modelandview onsubmit(httpservletrequest request, httpservletresponse response, object command, bindexception errors) throws exception { //iterate on key-value pairs }
fyi: table dynamically generated retrieveing id's not option because don't know how many key-value pairs there are.
use servletrequest#getparametermap()
retrieve map containing parameter names keys , parameter values map values. javadoc here
Comments
Post a Comment