I am doing the following in my SampleServlet.java
//Fill resultset from db
....
try {
ArrayList Rows = new ArrayList();
while (resultSet.next()){
ArrayList row = new ArrayList();
for (int i = 1; i <= 7 ; i++){
row.add(resultSet.getString(i));
}
Rows.add(row);
}
request.setAttribute("propertyList", Rows);
RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher("/DisplayProperties.jsp");
requestDispatcher.forward(request,response);
and then in my jsp DisplayPropeties.jsp I have
<%
ArrayList rows = new ArrayList();
if (request.getSession().getAttribute("propertyList") != null) {
rows = (ArrayList ) request.getSession().getAttribute("propertyList");
}
%>
but rows
is always null.
What am I doing wrong?