How to get values of all input fields which have the same name? [closed]
I am using JSP for my webpage. I used JavaScript to get a dynamic textbox and it works fine. But, my problem is how to take the values to next page as the dynamic te开发者_Go百科xtboxes have all the same name?
If all input fields have the same name, use HttpServletRequest#getParameterValues()
instead to grab the submitted values of all input fields with the same name. With getParameter()
only the first one will be returned.
String[] values = request.getParameterValues("fieldname");
Unrelated to the concrete problem, you'd like to do the form processing job in a Servlet class instead of a JSP file. To learn more about Servlets, check our servlets info page.
精彩评论