aspose file tools*
The moose likes Struts and the fly likes Problems with sessionID persistence... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problems with sessionID persistence... " Watch "Problems with sessionID persistence... " New topic
Author

Problems with sessionID persistence...

Louis - Jean Morisset
Greenhorn

Joined: Aug 25, 2003
Posts: 20
(Sorry if I posted this topic in two places, I am new to this website and didn't know there was a Struts section....)
Here is the context: Weblogic 6.XX, Struts, jsp 1.1, sdk 1.4. So we have..., I have problem in session persitence. When I open two browsers on one PC (this website where you can look a some monthly transactions) and ask to each browser to do a search on a particular account. Let's say the first browser gets the information right. And then you ask the second browser to get a diffrent account information. It get's it right too. But if I then ask the first browser to refresh the information of the first account by clicking refresh on the browser, I get the information of the second account from the second browser in my first browser. In my logs, when I now browse in my first browser, I see the session Id of the second browser and the initial session ID has desapeared. We are using Struts, therefore we get the session that struts sends us back!!! Unless there is another way to bypass the session returned by struts?? But then why use sturts??? So is there a way to bypass the cookies used by struts to manage the session ID's and force the session ID that you want to have??? HELP!!! This is kinda urgent like the rest of everyone stuff ;-) Thanks Louis PS: This problem is only if I have two browsers on one PC. The sessions don't get mixed up between different machines. Thank go for that!!!
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

Your browser windows are sharing the same session. There are a couple of ways I can think of to handle this problem and I have used them both in my Struts applications before.
One is to keep the query string as a hidden field in your form and keep the results in the request scope (using request.setAttribute). That is, you don't keep the resultset as a property of your form. The client refreshes or page through the results, he'll send the query string again, accompanied by any additional parameters needed to handle paging logic, etc.
Or if you want to keep resultsets in the session to avoid requerying the database a lot, you'd have to put different resultsets into a session-scoped collection (on the form will work since forms are session scoped) and send back the key into the collection to the client. As each client submits a query request, he will receive back the query key or id along with the results. When he has to page or refresh, he'll submit the key/id along with the request and the server can retrieve the correct resultset from the collection.
If your resultsets are not that large, the requery every time approach will be simpler. If performance is a concern, the second approach may help but be sure to use a profiler so that you can objectively compare the two methods.


Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with sessionID persistence...