What Are JavaServer Pages?
Although servlets are powerful, they have some disadvantages. They can be cumbersome to program, and every change requires the intervention of the servlet programmer.
Sun understood this problem and developed JavaServer Pages (JSP) as the solution. JSP combines HTML with JSP tags in a file that has a .jsp extension. When the HTTP request contains this extension, the Web server runs the JSP in the servlet container, which converts it into a servlet. After it is compiled, further requests for the .jsp file run the servlet without the compilation process, unless the .jsp file is changed on the server.
Division of labor between a programmer and a page designer is much easier in JSP, and compilation takes place automatically when a JSP is modified. Note that though JSP is an extension of the servlet technology, it does not make servlets obsolete. In real-world applications, servlets and JSP pages are used together.