0

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

5
Contributors
4
Replies
10
Views
9 Years
Discussion Span
Last Post by Jarvisk
0

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

0

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()) %>">
<%
     }
%>
0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.