Thank you to all who tried to help me out earlier.
Here is something interesting, perhaps some of you can shed some light on
this:
I have two Servlets; a LoginServlet, and a WelcomeServlet.
LoginServlet is responsible for validating a password, and then setting up
the user session. Because I do not want the username/password visible in
the URL, LoginServlet implements a doPost method. It should then redirect
the user to the Welcome page.
WelcomeServlet is responsible for displaying a welcome page, with some
details specific for each user. Since I wish to access this page as a
normal html page, it implements a doGet method.
Despite moving the HttpSession session = req.getSession(true) call to the
top of the method, and buffering the output before returning, for both Login
and Welcome, Netscape was generating a new session for each. This was a
source of great stress, because the sessions worked in IE. If I ran the
servlets off of JavaWebServer, the tracking also worked.
After playing with the system, I found that if I re-assigned the session in
Welcome, then other servlets would recognise the session....
TO MAKE A LONG STORY SHORT:
I changed LoginServlet to implement a doGet method, and POW!! Suddenly
sessions were being recognised under Netscape.
Conclusion: for whatever reason, Netscape and JServ generate a new session
if the flow goes from "doPost"s to "doGet"s. This problem does not occur in
IE, or if the servlets are being served by JWS. (I haven't tried any other
Java Application Servers).
This leaves me with three questions:
1) Is this normal? Is this supposed to be the case? If so, why doesn't
happen under IE, or when running another Java Server?? If this is not
supposed to happen, then why do you suppose JServ and Netscape don't get a
long?
2) Has anyone encountered this strange behavior before? Or have all your
servlets all been one or the other, and never a mixture of the two ACTION
methods? Is it possible I have a wierd config problem, or my design is
fundemetaly wrong if I'm using a mixture of Posts and Gets... ?
3) Can anyone repeat this strange behavior? that is; set up a page to POST
data to one servlet (which will then start a session), which will generate a
page with a regular link to another Servlet that will implement a doGet
method, and see if the session still exists under Netscape.
Please let me know what you think is happening; and if its my fault or some
crazy bug..!!
Thank you in advance!!
MV
Mike Varley
[EMAIL PROTECTED]
-- --------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]