How to send arrayList from JSP to Servlet. Is it possiple
Yes definitely it is possible, you need to
- Populate the arrayList object in the request object.
- Retrieve the list in servlet.
As you have not provided information whether you are using scriptlets or jstl, I'm assuming the scriptlets.
In your JSP,
request.setAttribute("arrayList", yourListObject);
RequestDispatcher rd = request.getRequestDispatcher("servletUrlPattern");
rd.forward(request, response);
In your servlet, you can access the list using
List yourList = (List)request.getAttribute("arrayList");
To call the servlet from your JSP file,
<form action = "yourServletUrl" method = "POST">
//everything in the form here.
<input type = "submit" name = "submit">
</form>
After pressing submit button, you will be able to get your jsp data into it.