What is JSP in Java

Java Server Page


JSP stands for Java Server Page. JSP's are used to develop dynamic web applications. JSP's are introduced to overcome the disadvantages of servlets. In the MVC (Model View Controller) design Jsp's are used for view and servlets are for controller purpose.

Jsps are translated into servlets at runtime. Each Jsp is translated and cached for reusability until any modification is done for original Jsp. So, the jsp pages are relatively faster.

Jsp pages are java code in HTML pages. In Jsp you need to insert java code by using JSP tags such as scriptlet and expression. So, It is easier for developers to write code in jsp than servlets.

There are nine implicit objects in jsp like request, response, session, application, config, page, pageContext, exception and out. JSP Engine creates these objects during the translation phase.


Advantages of Jsp:


  • In jsp, we can easily separate the presentation code with business logic. In the servlet, we need to combine both.
  • In servlets, the println statement is used to present the HTML code which is very difficult for developers.
  • Jsp pages are easy to maintain.
  • We can use exception handling feature as it is one of the nine implicit objects.
  • We can write servlet code in jsp pages.
  • Jsp's are cached for reusability, So they are faster than the servlets.

Post a Comment

0 Comments