Servlet Technical Questions

Ok. Here is the scenario....

I have two buttons on a Browser. Both buttons are attached to the same Servlet.

Say Button1, Button2

Button1 clicked - Set of data is transferred to the doPost(). Data is picked up in the doPost() and saved in a GLOBAL VARIABLE(s)
Now the Screen Referfhes
Button2 is Clicked - a Different set of data is transferred to the doPost(). Data is picked up in the doPost() and saved in a GLOBAL VARIABLE(s)

SO here are the questions...
1. Is the same Servlet instance in the Server-Side Container still exists when the second button is clicked? SO that the data I sent via the first click is NOT LOST when the second is clicked?

2. If a another user opens up a brower in his machine while I am working, and goes to the same program, will BOTH SHARE the
save Servlet instance or a different servert?

Thanks
prain
prainAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bloodredsunCommented:
Firstly you need to define what is meant by GLOBAL VARIABLE(s).

Besides class and instance members/variable, servlets and JSPs have 3 types of storage in memory - request, session, application of increasing levels of persistance.

If you meant storing your data in the session, your answers would be

1./ Yes, the data is persisted across the users page views
2./ Yes and No, the same servlet may be used but the data is kept in a user specific manner

If you meant storing the data in a class or instance member:

1./ Yes
2./ Depends on the load but most probably the same servlet. This is why you do not store information in class or instance members as it is not threadsafe.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bloodredsunCommented:
Thanks prain.

As a general guide, if an answer is not comprehensive enough to warrant an A grade feel free to ask for clarification so that the experts can at least try to earn an A grade.
prainAuthor Commented:
Ooops. I did not mean to give a B grade. Probably I clicked the wrong button in a haste.
You, I consider as an expert and my guding light in my development here.

Sorry about that!.

More quesitons coming up.!!! :-)
bloodredsunCommented:
haha, no probs prain :-)

I've been around here too long to be worried about points all that much but to the newer guys it really helps to get them fighting to answer your questions when you get known as a person would gives A grades for quality answers.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.