Announcement Announcement Module
Collapse
No announcement yet.
Managing objects being held in session Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Managing objects being held in session

    I want to know if someone could recommend "rules of thumb" when deciding whether to keep or not objects in servlet session between different requests

    Alternatives, PROS and CONS, etc

    Thank you

  • #2
    I personally try to put as few stuff as possible in the session. The main reasons are from a user perspective. I would rather be able to bookmark pages & send links that directly open a specifc page, and if I fork a session (Open link in a new page/tab), then I don't want changes in one page/tab mess with the other one.

    Comment


    • #3
      I forgot too, putting stuff in the session scope might create issue when using back too. Also, to avoid problems with back button and refresh, I use GETs anytime an operation doesn't modify the database, and when I use POST, I never display directly a page, I always use a redirect to a GET.

      Comment


      • #4
        Thanks a lot, champ.

        I want to know alternative mechanisms for session holding avoidance

        For instance, a friend of me sends data back and force between web server and client browser

        I dont like it too much because we are adding complexity on pages (remember that web means hypertext, so you have to drag use case-related info in the whole presentation layer)

        Another one is persists some data in a cache (memory -similar to keep in session and maybe problematic on clusters- or secondary storage)

        Even, to store use case related info on database



        I want to know if someone could tell personal experiences approaching this problem

        Comment


        • #5
          I'm not sure I really understand your question, but when I want information to be passed from one request to another I add the minimum needed to every link (i.e. IDs), so that I can retrieve the data before handling the request, with the data possibly cached somewhere.

          Concerning when to put stuff in the HttpSession, I usually only do that when the data is user specific. For example, items in a shopping cart are user specific, while a search result could be meaningful for anyone.

          Not quite sure my answer is useful, since I'm unsure what kind of answer you were looking for, but I hope it helps.

          Guillaume

          Comment

          Working...
          X