In the servlet code with the request.setAttribute("servletName", categoryList) instruction request.setAttribute("servletName", categoryList) you save your list in the request object and use the name "servletName" to refer to it.
By the way, using the name "servletName" for a list is pretty confusing, maybe it's better to call it a "list" or something similar: request.setAttribute("list", categoryList)
In any case, suppose you do not change your servlet code and save the list using the name "servletName". When you come to JSP, you need to get a list from the request, and for this you only need the request.getAttribute(...) method.
<% // retrieve your list from the request, with casting ArrayList<Category> list = (ArrayList<Category>) request.getAttribute("servletName"); // print the information about every category of the list for(Category category : list) { out.println(category.getId()); out.println(category.getName()); out.println(category.getMainCategoryId()); } %>
Cadavere
source share