• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Java session problem

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai, My problem is : In a jsp form i have several case-form links. If i open one case-form and navigate through its form and again if i open a second case form without closing the first opened case form, i can see the first case fields & its values on the secong case form...This is because we are getting the values of the fields in session. As i am not closing the page, it is carrying to the second form too..How to avoid this problem? Please suggest me any solution for this...i can open only 1 case-form at a time.

Thanks for patiently reading my problem...and thanks in advance for the help...
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you feeding values to a case form?
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sessions are typically stored in cookies, and how cookies are shared between tabs / windows is browser and configuration dependent, but typically they are shared, and you should assume that all windows / tabs from a given client will share the same cookies.

The solution is to NOT use cookies to store session ids. This requires work - including re-writing every URL so that it encodes the session id when needed (you should do this anyway) and re-configuring the application container to not use cookies. To learn more you should be able to google for Java servlet session management, or something similar, to get details.
 
Padmaja Singanamala
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Himanshu, i am getting values for the case(jsp) form through session.
 
Sheriff
Posts: 22856
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to JSP.
 
Padmaja Singanamala
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Steve,

Thanks for the detailed explanation. Just to mention you, my problem is not at all related to cookies as i am not using cookies anywhere in my application. It purely session problem. Session object is storing the preious jsp form values and displaying in the another jsp form This happens when the second jsp form is opened without closing the first jsp form. I want help regarding how to avoid showing wrong values.



 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Padmaja Singanamala wrote:Hi Steve,

Thanks for the detailed explanation. Just to mention you, my problem is not at all related to cookies as i am not using cookies anywhere in my application. It purely session problem. Session object is storing the preious jsp form values and displaying in the another jsp form This happens when the second jsp form is opened without closing the first jsp form. I want help regarding how to avoid showing wrong values.



How does your container track a user with his session?

This is typically done using cookies - and typically using a cookie names jsessionid with the application's domain. So you may not be using cookies, but the JEE container you are using that controls sessions most likely is.
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it necessary to feed the form from session? Can the form be empty or contain static default values when opened?
If the answers to the above questions are YES and NO then use request instead of session. I assume that the request is not shared b/w the 2 JSPs.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic