I know this isn't hard, but I'm not having any luck.
I want to make fooList
from a Servlet available in a JSP. So in the Servlet I have:
request.setAttribute("list", fooList);
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("/myJsp.jsp");
dispatcher.forward(request, response);
Then in the JSP, I want:
<c:forEach var="post" items="${SOME_EL_HERE}">
<!-- stuff -->
</c:forEach>
Where SOME_EL_HERE
is an expression that retrieves the attribute that I have set on the request
.
Any thoughts? My preference is to not complicate a simple task by adding a framework, but I'm open to changes in strategy.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…