aspose file tools*
The moose likes Struts and the fly likes In MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "In MVC" Watch "In MVC" New topic
Author

In MVC

bakiyalakshmi dhanraj
Greenhorn

Joined: Nov 02, 2007
Posts: 24
In a architecture pattern like MVC, it is mandatory that Servlet should
be the controller, why not JSP?
subodh gupta
Ranch Hand

Joined: Jul 23, 2007
Posts: 203
Their are couple of reasons for using servlet and not jsp as controller component.

1) JSP should not include the java code which is the integral part in building the controller as you need to perfrom various checks on in coming request.

2) JSP is meant for the developers which need not have the java knoeledge

3) Your controller intracts with your model and hence not directly accessed from the browser which is not the case with the JSP


http://subodh-gupta.blogspot.com
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I started to type up a response but the following article (almost 10 years old) does a better job:

http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html

Nothing is "mandatory" but if you have ever worked on a project with 2000 line JSP files you will know how hard they are to develop, debug and maintain.

- Brent
 
 
subject: In MVC