It's not a secret anymore!*
The moose likes JSP and the fly likes tomcat session problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "tomcat session problem" Watch "tomcat session problem" New topic
Author

tomcat session problem

felix thomas
Ranch Hand

Joined: Jun 10, 2001
Posts: 89
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 ]
shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
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,
Anselm Paulinus
Ranch Hand

Joined: Sep 05, 2003
Posts: 389
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat session problem
 
Similar Threads
Three dim array
Doubt In foreach Loop
arrayindexoutofbound exception
2 dim array
problem in the two listener with in the textarea