• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Problems with sessionID persistence...

Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(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!!!
Posts: 16963
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
This tiny ad is guaranteed to be gluten free.
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic