Whenever we write in a JSP page, that JSP page will undergo the following phases:
Translation phase: It is one which converts .jsp program into .java program internally by the container. Once the translation phase is completed the entire JSP program is available into a pure java program.
Compilation phase: It is one which converts .java program into .class file provided no errors found in .java program by the container. If errors are found by the container in .java program those errors will be listed in the browser.
Execution or Running phase: It is the process of executing .class file by the container.
|Limitations of servlets||JSP provides|
|In order to develop any servlet they must know java language.||To write any JSP program java language is not necessary i.e., a non-java programmer can write the JSP page effectively.|
|Servlets provides uncomforting. Since, in a single servlet we are writing presentation logic and application or business logic.||In JSP there is a separation between presentation logic and application or business logic.|
|Maintenance and deployment problems are more (servlets allows only static changes).||JSP page can minimize or reduce maintenance and deployment problems. Since, it allows dynamic changes.|
|Important: Servlets does not provide automatic page compilation i.e., every servlet program must be compiled explicitly.||JSP provides automatic page compilation (every JSP program internally translated as a java program by the container which is nothing but servlet).|
|Servlets does not provide any custom tag (user defined tag) development.||SP provides the features to develop custom tags|
|Servlets does not provide any implicit objects.||Every JSP page contains 'n' number of implicit objects such as out, session, exception, etc.|
When we make very first request to a JSP page, translation phase, compilation phase and execution phase will be taken place. From second request to further sub sequent requests only execution phase taking place provided when we are not modifying JSP page.