• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

tomcat session problem

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I have a jsp application running on Linux 8.0 with Tomcat 3.3a as the server.

The problem is I have put an String arr[] in the session object. When i get the arr[] for the first time it works fine,but when i reload the page the data in the arr[] becomes blank but the length shown is fine.
For detail clarification
------------------------
1) UserInfo.java
private String sClientPlaceId[];
The get and set methods are provided in this class as below;
public String[] getClientPlaceId()
{
return sClientPlaceId;
}
public void setClientPlaceId(String sClientPlaceId[])
{
this.sClientPlaceId = sClientPlaceId;

}

2) I am putting setting the above array at the time of logging in the system and into the Session after setting it.

3) When i generate the a report for the first time i log in i get the values in the arr1 and the length shown is also fine
e.g. arr1.length = 79
arr1[0] = "User 1"
But when i reload the same Jsp page the get the array values as below
String tt[] = user.getClientPlaceId ;
tt.length = 79 is fine ,but
tt[0] = "" shows blank
I am not setting again the array anywhere else. and how it is working when i load it first time and not the page is loaded the second time.

Can anyone help me out Please ,its urgent.

Thanx,
Fx

[ December 01, 2003: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by felix thomas:
hi,
But when i reload the same Jsp page the get the array values as below
String tt[] = user.getClientPlaceId ;
tt.length = 79 is fine ,but
tt[0] = "" shows blank


You are not getting the array from the session but from the instance variable. user.getClientPlaceId returns the instance variable. You must in fact access the session variable that holds the array....
Hope this helps.
Regards,
 
Ranch Hand
Posts: 390
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a pointer:
If it is not absolutely necessary that you must use a static array. I advice you use something dynamic like vector or arrayList. I prefer arrayList.
 
Alas, poor Yorick, he knew this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic