+ Reply to Thread
Results 1 to 2 of 2

Thread: Session persistence across JSP/HTML/servlet

  1. #1

    Default Session persistence across JSP/HTML/servlet

    I think perhaps I misunderstand the concept of session persistence. In general, the idea is to a request.getSession(true) to get a new session (if it doesn't exist), and a request.getSession(false) to get the existing session (or null if it doesn't exist). Finally, session.invalidate() gets rid of the session. (Am I right so far?) Okay, given that understanding, and I thought then that it was up to the HTTP server to determine and hold the persistence of that connection. How? I don't know, it's magic. And I hate magic. For example, how can the HTTP server distinguish between two different instances of a browser on one PC? They have the same source IP address, so what tells them apart? So I figure it's something in the HTTP protocol that communicates between the server and the browser, and I continue on my merry way. But it's still bugging me, so I decide I better check. So I do this: I run a JSP, which creates a session using getSession(true) - this works, because I print out the ID. The JSP has a hyperlink to an HTML page. The HTML page has a form/button that POSTS to a servlet. The servlet does a getSession(false). Silly me, I expected the servlet to get the same session that I created in the JSP. But noooooo... I get null. Somewhere the connection got broken and I lost my session. So which part am I miunderstanding? Is the session not valid across different web components (JSP, HTML, servlet)? Is the session only valid on a single servlet (that is, does everything have to go through a master servlet, which figures out the data flow)? Did I forget to set a switch in my HTTP server or in WebSphere? I'm using WAS3.0 on V4R4, if that helps. Joe

  2. #2
    Guest.Visitor Guest

    Default Session persistence across JSP/HTML/servlet

    Joe,

    http://www.ibm.com/developer

    has a nice on-line tutorial on "Building Servlets with Session Tracking".* You might want to check it out.

    Also from:

    Building AS/400 Applications for IBM

    WebSphere Standard Edition 2.0

    The javax.servlet.http.HttpSession interface is implemented by WebSphere to provide session support. Under the covers HttpSession information is maintained SIZE="2">either by using cookies or by URL rewriting described previously. The FACE="Helvetica" SIZE="2">administration GUI can be used to enable session support using URL rewriting FACE="Helvetica" SIZE="2">cookies as shown in Figure 137 on page 150. If both options are checked,cookies are used if the browser accepts them. Otherwise, URL rewriting is used.

    Nathan.


+ Reply to Thread

Similar Threads

  1. Replies: 2
    Last Post: 09-16-2006, 12:10 PM
  2. Path for javax.servlet & other servlet help needed
    By J.Pluta in forum Programming
    Replies: 15
    Last Post: 05-24-2001, 11:55 AM
  3. servlet persistence question
    By Guest.Visitor in forum Programming
    Replies: 4
    Last Post: 09-05-2000, 02:10 AM
  4. Servlet Configurations
    By Guest.Visitor in forum Programming
    Replies: 2
    Last Post: 03-03-2000, 11:08 AM
  5. Servlet /RPG problem.
    By Guest.Visitor in forum Programming
    Replies: 3
    Last Post: 02-15-2000, 02:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts