RSS Forums RSS
Please support our JSP advertiser: Lunarpages JSP Web Hosting

send session variable in an array

Join Date: Jan 2008
Posts: 35
Reputation: electron33 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
electron33 electron33 is offline Offline
Light Poster

Solution Re: send session variable in an array

  #3  
Feb 5th, 2008
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()) %>">
<%
     }
%>
Last edited by electron33 : Feb 5th, 2008 at 4:40 pm.
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:44 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC