i was searching for the same problem as mine, but i didn’t find anything. This is my problem:
I have ArrayList which includes beans. My beans is class ‘Row’. There are setters and getters.
This is method from Database class:
public ArrayList<Row> getDatalist() {
datalist = new ArrayList<Row>();
try {
String query = "SELECT * FROM ...";
ResultSet r = s.executeQuery(query);
while(r.next()) {
Row row = new Row();
row.setLocation(r.getString(4));
row.setVolume(r.getInt(3));
row.setTime(r.getTime(5));
row.setDate(r.getDate(5));
datalist.add(row);
}
} catch (SQLException e) {
e.printStackTrace();
}
return datalist;
}
My servlet:
ArrayList<Row> rows = db.getDatalist();
request.setAttribute("rows", rows);
request.getRequestDispatcher("/main.jsp").forward(request,response);
And at least ‘main.jsp’:
<c:forEach var="row" items="${rows}">
<c:out value="${row.location}"></c:out>
</c:forEach>
The problem is that ${row.location} is empty. My page source:
<c:forEach var="row" items="[webservice.model.Row@1e41769, webservice.model.Row@1bd0815, webservice.model.Row@15dd716, webservice.model.Row@1d40d08]">
<c:out value=""></c:out>
</c:forEach>
Any idea? Thanks a lot.
Well, your page source indicates the problem clearly: the
ctags aren’t interpreted by the container. This means that you forgot to declare thectaglib at the top of the JSP: