Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

In MVC

 
bakiyalakshmi dhanraj
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a architecture pattern like MVC, it is mandatory that Servlet should
be the controller, why not JSP?
 
subodh gupta
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic