Wednesday, 15 June 2011

java - How to iterate a list of objects using jsp -



java - How to iterate a list of objects using jsp -

i trying iterate list of objects in jsp using jstl, when i'm trying access parameter returns parameter name, here 'destination' instead of actual value. doing wrong?

here part of jsp:

<c:foreach items="${journeys}" var="journey"> ${journey.destination} </c:foreach>

here 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 ); }

and journey object containing:

public class journey { private string destination; public void setdestination(string destination) { this.departure = destination; } public string getdestination() { homecoming destination; } }

try :

<c:out value="${journey.destination}"/>

java jsp

No comments:

Post a Comment