Use RequestDispatcher#forward() :
public void doSomething(HttpServletRequest request, HttpServletResponse response) { List<Item> items = itemDAO.list(); request.setAttribute("items", items); request.getRequestDispatcher("page.jsp").forward(request, response); }
JSP example:
<table> <c:forEach items="${items}" var="item"> <tr> <td>${item.property1}</td> <td>${item.property2}</td> </tr> </c:forEach> </table>
Hope this helps.
source share