This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
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: 63552

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:
subject: MVC pattern doubt
It's not a secret anymore!