Oscar Kind said:
What method did you use to determine whether there is a session or not?
Personally, I use the method you describe below, and have never failed to
receive a valid session. Sure, the client may only know about it when the
request returns (and states the session id in a session cookie). But this
is not a problem AFAIK.
AFAIK, this is the only way to properly create a session. I may be wrong,
however.
Oscar
Thanks Oscar. Let me expand on my problem.
I have a java applet running inside the html produced by the java
servlet.
Basically, the applet is a file select box to allow for selection of
directories, since this functionality was declared a bug by Mozilla
and Netscape in their implentation of the HTML FileBox.
In order to pass the parameter selected from the applet to the
servlet, we have written a second servlet which implements a HashTable
to store the session_id and the parameter. Other servlets can then
query the HashTable using the session_id as a query parameter to
retrieve the value selected in the FileBox.
The thing is: if the querying method cannot obtain a session_id, it
cannot query for the parameter. Likewise, if there is no session id
the Filebox cannot place a null value as a key in the HashTable.
My app is setup so that you:
1) first view a static web page
2)then view a servlet webpage which encodes a series of HTML links.
This servlet sets the session_id using the HttpSession session =
request.getSession(true); method.
3)Then the next page generated by a different servlet contains the
FileBox and again uses the HttpSession session =
request.getSession(true); method.
Here is the weird part: When I serve the static html page (#1 above)
from an Apache web server all works as planned. #2 establishes a
session which can be used in #3. However, if I run standalone and
open the webpage in #1 from the Tomcat server, or even just use
open-->File in my web browser then a session id is never established.
If I press reload on the web browser, then I will get a session id.
I am using Tomcat 3.2.4 and Mozzilla 1.4. I have also tested on
Tomcat 4.1.27.
I hope this gives a clearer picture of whats going on.
-Mike