0
我想在我的jsp中使用jstl迭代一个对象列表,但是当我试图访问一个参数时它返回参数名称,这里'destination'代替实际价值。我究竟做错了什么?如何使用jsp迭代对象列表
这里是我的jsp的一部分:
<c:forEach items="${journeys}" var="journey">
${journey.destination}
</c:forEach>
这里是我的servlet:
protected void doPost(HttpServletRequest request, HttpServletResponse response) {
SearchForm form = new SearchForm();
List<Journey> journeys = form.searchJourney(request);
request.setAttribute("journeys", journeys);
this.getServletContext().getRequestDispatcher(VIEW).forward(request, response);
}
的旅程对象包含:
public class Journey {
private String destination;
public void setDestination(String destination) {
this.departure = destination;
}
public String getDestination() {
return destination;
}
}
做过这份工作,谢谢! – Yonnaled 2014-11-03 23:48:43
没问题,我回到了同一个问题... – 2014-11-03 23:51:55