My index.jsp page:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<title>JSP page</title>
</head>
<body>
<c:forEach items="${list}" var="item">
${item}<br>
</c:forEach>
</body>
</html>
My servlet:
public class MainServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
List<String> list = new ArrayList<>();
list.add("Item 1");
list.add("Item 2");
list.add("Item 3");
request.setAttribute("list", list);
System.out.println("Servlet is working!!!!");
request.getRequestDispatcher("/index.jsp").forward(request, response);
}
}
In the console I see the message “Servlet is working!!!!”, that is, the serverlet responds to the browser request and sends the page. But list parsing does not happen. Instead of a parsed list I see this in my brouser: "${item}"!!!
