Win a copy of Murach's Python Programming this week in the Jython/Python forum!
    Bookmark Topic Watch Topic
friki data migration
Ranch Hand
Posts: 772
  • Mark post as helpful
  • send pies
  • Report post to moderator
Even though JSPs are based upon Servlet technology, that does not mean that they are interchangable. It also doesn't mean that they are competing technologies.

Rather, both of JSPs and Servlets have their place in a well-structured web application.

So the question never is really "JSP or Servlets", because the answer is "JSP and Servlets".

In a properly structured web application servlets will be used for control (the 'C' part of MVC) and JSPs to render the views (the 'V' part).

For more information, search for the terms MVC and "Model 2" with respect to web applications. Also, this Javaranch Journal article explains the evolution of modern best practices with regards to web application structure.

Also note that there are some things JSPs can't do, e.g. generate (or stream) binary content. For those, servlets must be used.

It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!