String Array from one JSP to other JSP

Hi, How to pass String array from one JSP to other JSP ?Thanks,-Priya
[104 byte] By [Priyam] at [2007-9-26 1:51:23]
# 1
use HttpSession.setAttribute()
vdsharma at 2007-6-29 2:59:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Method 1:

// In JSP1

session.setAttribute("myStringArray", myStringArray);

response.sendRedirect("jsp2.jsp");

// In JSP2

String [] myStringArray = (String []) session.getAttribute("myStringArray");

Method 2:

// Int JSP1

request.setAttribute("myStringArray", myStringArray);

response.forward("jsp2.jsp");

// In JSP2

String [] myStringArray = (String []) request.getAttribute("myStringArray");

When placing objects in the session, they will persist there until removed, or until the session expires.

When placing them in the request, they only persist for a single request. They will only be available to included pages, or pages that you forward to.

-Derek

beattris at 2007-6-29 2:59:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Thank you very much.-Priya
Priyam at 2007-6-29 2:59:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...