You need not have to give seperate field names. All can be given same field name and use getParameterValues("fieldName") of the Request object. This will return a
String[] with field values entered by user in the same order.
Ravi.
You can
test using the following example.
Html form:
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM action="http://localhost:8080/servlet/Handle" method="POST">
<INPUT name="name">
<INPUT name="name">
<INPUT name="name">
<INPUT name="name">
<INPUT name="name">
<INPUT name="name">
<INPUT name="name">
<INPUT name="name">
<BUTTON TYPE="SUBMIT"> SUBMIT
</FORM>
</BODY>
</HTML>
servlet:
public class Handle extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body bgcolor=\"white\">");
out.println("<head>");
out.println("</head>");
out.println("<body>");
String[] params = request.getParameterValues("name");
for (int i =0 ; i < params.length; i++)
{
out.println(params[i]);
}
out.println("</body>");
out.println("</html>");
out.println("</body>");
out.println("</html>");
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
doPost(request, response);
}
}