Is there anything which a servlet can perform but a JSP cannot and vice versa ?

Serge Knystautas

A JSP is generated into a servlet, so there is very little that one can do, but not the other. JSPs are generally considered a "convenient" way to write servlets. However, there are the following differences:

  • JSP cannot return binary data. This is because a JSP always calls response.getWriter(), and returns a JspWriter.
  • Servlets cannot readily use JSP Tags. This is somewhat obviously, but custom tags can sometime include business logic or other functionality that a page developer would want to call. It technically is possible for a servlet to call a custom tag, but it is lengthy process.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact