Hi,

>         IS the following statement true?
>
>         when multiple instances of a same browser window are opened
through
> menubar
> option File->New->Window ,all the screens(servlet generated html) will
share
> the same session
> or thread created for doGet/doPost.so whatever written to session in one
> window
> will be reflected in another window as they use the same session .

Yes this is true if you use cookies for session management. If you use url
rewriting/hidden variables for the session management then these windows
will have different sessions. This is because for the browser the cookie for
the session is same as any other cookie. When the browser returns a cookie
which contains the session ID it does not depend upon which window for
responsible for receiving the cookie. It depends upon which site the cookie
should be sent to. Hence all windows send the same cookie to the browser and
have the same session. In url rewriting/hidden varialble the session which
it belongs depends upon the information available to that window alone.

As for sharing of threads is concerned, there no sharing of threads (nothing
in the specs but as per implementation). The servlet API is request/response
architecture and each request is handled in a seperate thread. Of course
threads may be reused in a thread pool but at no time does one thread
service more than request.


> Assuming that above statement is true we generally invalidate the session
in
>
> login servlet if already exists and create a new session.

I think this will be reflected in all windows using the new session ID.

I want to ask one doubt here. If I send two cookies having valid session ids
( I coded that way, or the client is up to hacking) then which session ID
will be used. I think the specs are silent on this. It must be
implementation/container dependant.. Am I correct here??

regds,
Gokul

> Regards,
> Ravi
>
>
>
> -----Original Message-----
> From: Raj Kumar Jha [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 12, 2000 7:41 AM
> To: [EMAIL PROTECTED]
> Subject: Re: A question about the fundamentals!
>
>
> Are you providing the same user id and password on all the sessions and
are
> you using session tracking ??
> Raj
>
>
> ----- Original Message -----
> From: Vijaya Bhaskar Varanasi
> To: [EMAIL PROTECTED]
> Sent: Thursday, October 12, 2000 2:54 PM
> Subject: Re: A question about the fundamentals!
>
>
> Hi everybody,
> In this context, I want to share my experience with similar (but may not
be
> same) problem.
>
> I have a simple html form submitting login name and password to a simple
> servlet. The servlet validates the password and tells the user whether he
is
> logged in or not.
>
> When I open 4 browser windows (all of IE 5.0 on same m/c) and submit the
> parameters at the SAME time, three browser windows are blank (no response
> info is displayed in them) and one browser window displays four messages
> corresponding to all four attempts to login.
>
> Can we related this behaviour related to what has been discussed here ?
But,
> we do not have any 'dynamically' changing variable defined out side the
> doPost method!. All the servlet does is to respond to the client with
> relevant info whether the user is logged-in or not !
>
> Can some body please explain this behaviour ?
> regards,
>
> Bhaskar Varanasi
> IIC Technologies Pvt. Ltd.,
> Hyderabad.
> http://www.iictechnologies.com
>
> Alternate e-mail :
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
>
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Gokul
> Singh
> Sent: Thursday, October 12, 2000 1:57 PM
> To: [EMAIL PROTECTED]
> Subject: Re: A question about the fundamentals!
>
>
> > It worked.  Now I had 3 web browsers loaded on my machine and added
> > different values to each text box (one per web page).  I then executed
the
> 3
> > Web Pages at the same time.  Well! the results were different! Sometimes
> all
> > pages showed the same result and sometimes 2 would etc...  It took me a
> > while to understand what had happened;
>
> It is sometimes really frustating to debug the bugs introduced due to
> multithreading. You had more than one thread executing through your sevlet
> and that is what caused the problem.
>
>
> > I believe that you should not declare
> > objects that will have dynamic data outside of the method that is using
> > them.
>
> I don't think this is correct. Member variables are used for storing
> attributes of classes and the attributes of course can be dynamic in
nature.
> The problem that you faced was due to fact that multiple threads were
> executing the same method and hence accessing the same variable
> simultaneously and resulting in inconsistent results. The change to local
> variable in the method resulted in each thread having its own copy of the
> variable and hence the problems disappeared.
>
>
> regds,
> Gokul
>
> > Best Regards
> >
> >
> > Marc
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to