Hi
I want to send session variable in an array from one JSP page to another using code
given below
String[] textfield_a =(String[])session.getAttribute("textfield_a");
But i m getting error .
plz help

Can you plese be clear in ur requirement.
Atleast can u send me the code snippet,

Hi
I want to send session variable in an array from one JSP page to another using code
given below
String[] textfield_a =(String[])session.getAttribute("textfield_a");
But i m getting error .
plz help

Member Avatar for electron33

You can't cast to String[]. It does not exist in Java.

Try to use an ArrayList instead.

All JSP pages share the same session. You will always have the variable in session until the session is terminated or until you remove the attribute yourself.

When you want the values back into another page you could use some code like this. ArrayList list = (ArrayList) session.getAttribute("callername"); Now you have the values in the list. on the second page

Now you can get the value with following code.

<% 
     Iterator iter = list.iterator();
     while(iter.hasNext()){
%>
     <input type="text" name="textfield1" value="<%= String.valueOf(iter.next()) %>">
<%
     }
%>

I created session in jsp like session.setAttribute("arr",xxx);
I want to get that sessionin servlet.plz help me

How to pass a session to a normal function in a jsp?? so that the function can access all session variables..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.