简体   繁体   中英

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.

Add import statement for ArrayList.

import java.util.ArrayList;

Update

For importing ArrayList in jsp, use following syntax:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM