I have a variable declared in one jsp page. This variable is an array.
How can I retrieve this array in the next jsp page.
The code is likely to be:
<%
String[] a=new String[10];
int i=0;
while(resultSet.next())//here I'd retrieved the values from the Database
{
a[i]=resultSet.getString(1);
i++;
}
%>
now i have to retrieve this array a on the next page.
Put it in the session, which is an object shared among all pages and servlets of the web application:
And retrieve it with:
Instead if with
you mean the page that will be included in current page some lines after, you could also use request attributes (not parameters!), setting:
and getting: