Originally posted by Avijeet Dash:
Servlets don't separate view and controller. u write the html and business logic in servlet. in JSP only the dynamic view comes and business logic is in beans or other java classes.
Neither servlet or JSP support MVC particularly well, IMHO. It is up to you, the developer, to make sure you actually use this architecture. In fact this often doesn't happen and many of the JSPs I see in practice are riddled with Java code.
If you want to implement your web application using MVC, you would typically use JSPs, servlets, and beans. JSPs are presentation-centric, they are presentation with embedded code. Servlets are code-centric. Your choice between them depends on what you want to do.
The Model typically consists of JavaBeans, Enterprise JavaBeans, or Java classes. It certainly should not be a JSP or servlet as it does not handle requests or generate responses.
The View, then, would be a JSP because the presentation is so central to it. Beans and tag libraries can help you squeeze the last bits of Java code out of it.
The Controller is best driven from a servlet, as it is only logic (code) without any presentation element. In my experience the Command pattern works particularly well here, the task of the controller servlet is then to invoke the right command(s) in response to an incoming request.
- Peter
[This message has been edited by Peter den Haan (edited January 30, 2001).]