Display a list on a table using c:forEach
843844Oct 24 2007 — edited Oct 26 2007Hi, i am trying to display more than one entry from a list of routes in a html form. If i use the following i get 1 route displayed at a time:
<table>
<tr>
<td><h:outputText id="carrierCode" value="#{RouteHandler.carrierCode}"/></td>
<td><h:outputText id="deptAirport" value="#{RouteHandler.deptAirport}" /></td>
<td><h:outputText id="arrAirport" value="#{RouteHandler.arrivalAirport}" /></td>
</tr>
</table>
However, i need more than 1 route displayed at a time and i am using c:forEach. I am using the following code to try and display more than 1 route, however no routes are displayed:
<table>
<c:forEach var="curRoute" items="${RouteHandler.routeList}">
<tr>
<td><c:out value="#{curRoute.carrierCode}"/></td>
<td><c:out value="#{curRoute.deptAirport}" /></td>
<td><c:out value="#{curRoute.arrivalAirport}" /></td>
</tr>
</c:forEach>
</table>
I have included this line in <ui:composition
xmlns:c="http://java.sun.com/jsp/jstl/core"
If i use a JSTL tag <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> i get the following error;
"The markup in the document preceding the root element must be well-formed" even though i have standard.jar and jstl.jar in my classpath.
If anyone has any input or suggestions about how i get the routes to display using c:forEach or an alternative option i would really appreciate it.
Thanks