File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 60049

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

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: MVC pattern doubt
Similar Threads
SCEA assignment doubts
JSP to Bean to Servlet
design related interview questions
MVC Pattern doubt
How good is PRG (POST/REDIRECT/GET) pattern in avoiding duplicate form submission?