rameeza qureshi
rameeza qureshi

Reputation: 35

passing ArrayList from one JSP to another using session

          ArrayList<Object[]> custInfo = new ArrayList<Object[]>(); 
            while(rs.next()){
                String loginId = rs.getString("LOGIN_ID");
                String  customerId = rs.getString("CUSTOMER_ID") ;
                String  requestDate = rs.getString("REQUEST_DATE") ;
                
                 Object[] custInfo123 = {loginId, customerId, requestDate};
                 custInfo.add(custInfo123);
        }
             session.setAttribute("custInfo", custInfo);

in one jsp retreivedata.jsp im using arraylist to store values of result set and set session.setAttribute. and in other jsp downloaddata.jsp im using,

ArrayList<Object[]> custInfo = (ArrayList<Object[]>)session.getAttribute("custInfo");

but it has given me error ArrayList can not be resolved to a type.

Upvotes: 0

Views: 82

Answers (1)

Ankit Beniwal
Ankit Beniwal

Reputation: 529

Add import statement for ArrayList.

import java.util.ArrayList;

Update

For importing ArrayList in jsp, use following syntax:

<%@ page import="java.util.ArrayList" %>

Upvotes: 1

Related Questions