wood burning stoves
The moose likes Servlets and the fly likes MVC pattern doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "MVC pattern doubt" Watch "MVC pattern doubt" New topic

MVC pattern doubt

Suresh Yadla

Joined: Mar 26, 2005
Posts: 12
If I have an website with MVC pattern, and I have the servlet, JSP, and Bean.

In this scenario, if two users log in at the same time and the some state is store in bean then wouldn't there be a conflict or will each user have its own bean where some state/data could be kept for a while.

If there is a conflict then why should we use MVC pattern.


Suresh Yadla<br />SCJP, SCWCD, SCBCD<br /> <br />----------------------------------
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

A servlet is a multi threaded object.
Each request is handled within it's own thread.
As long as you instanciate your bean from within one of the service methods there will be no concurrency issues.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

Which all has little to nothing to do with MVC.
[ June 07, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: MVC pattern doubt
jQuery in Action, 3rd edition