Ref page 437 example from HFSJ. My output is just movielist and no movies listed after that. can someone please help me.
Here is my code from the
servlet public class cforeach extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
String[] movieList = {"Amelie", "Return of the king", "Mean Girls"};
request.setAttribute("movieList", movieList);
RequestDispatcher view = request.getRequestDispatcher("testjstl.jsp");
view.forward(request, response);
}
}
My code from the
JSP is
<%@ taglib prefix ="c" uri = "http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
<%@ page isELIgnored="false" %>
<strong> Movie List </strong>
<br> <br>
<table>
<c:forEach var="movie" items="${movieList}">
<tr>
<td>${movie}</td>
</tr>
</c:forEach>
</table>
</body></html>