Each JSP page is internally translated into an equivalent Servlet. Every JSP tag written in the page will be internally converted into an equivalent java code by the containers this process is called translation.
There are two phases are occurs in JSP;
- Translation phase
- Request processing phase
Translation phase: It is process of converting jsp into an equivalent Servlet and then generating class file of the Servlet.
Request processing phase: It is process of executing service() of jsp and generating response data on to the browser.
When first time a request to a jsp then translation phase occurs first and then after service phase will be executed. From next request to the jsp, only request processing phase is got executed but translation phase is not because jsp is already translated.
In following two cases only translation occurs;
- When first request is a given to the jsp.
- When a jsp is modified.
If a request is given to the jsp after it has modified then again translation phase is executed first and after that request processing phase will be executed.
- If we shutdown and restart the Servet then only request processing phase will be executed, Because when we shutdown the server java and class files are not deleted from the server.
- If we remove the class file from server then partial translation occurs..
- If we remove both java and class file from server then again translation occurs.
- When a jsp is translated into an equivalent Servlet then that Servlet extends some base class provided by the server, but internally it extends HttpServlet.