What is JSP and its life cycle?
A JSP life cycle is defined as the process from its creation till the destruction. This is similar to a servlet life cycle with an additional step which is required to compile a JSP into servlet.
Which of the following are the life cycle method of JSP?
Instantiation(Object of the generated Servlet is created) Initialization(jspInit() method is invoked by the container) Request processing(_jspService()is invoked by the container) JSP Cleanup (jspDestroy() method is invoked by the container)
What are servlet life cycle methods?
There are three life cycle methods of a Servlet : init() service() destroy()…destroy() method :
- The destroy() method is called only once.
- It is called at the end of the life cycle of the servlet.
What is JSP and its uses?
JavaServer Pages (JSP) is a Java standard technology that enables you to write dynamic, data-driven pages for your Java web applications. JSP is built on top of the Java Servlet specification. The two technologies typically work together, especially in older Java web applications.
How many stages are there in JSP life cycle?
Compilation process of JSP page involves three steps: Parsing of JSP. Turning JSP into servlet. Compiling the servlet.
What is the difference between JSP and servlets?
Servlets can accept and process all type of protocol requests. JSP on the other hand is compatible with HTTP request only. In Servlet by default session management is not enabled, the user has to enable it explicitly. On the other hand in JSP session management is automatically enabled.
What are advantages of using JSP?
The advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual Basic or other MS specific language, so it is more powerful and easier to use. Second, it is portable to other operating systems and non-Microsoft Web servers.
How many phases are there in JSP life cycle?
What is JSP processing?
JSP Processing The web server recognizes that the HTTP request is for a JSP page and forwards it to a JSP engine. This is done by using the URL or JSP page which ends with . jsp instead of . html. The JSP engine loads the JSP page from disk and converts it into a servlet content.
What is difference between doGet () and doPost () methods?
doGet() shall be used when small amount of data and insensitive data like a query has to be sent as a request. doPost() shall be used when comparatively large amount of sensitive data has to be sent. Examples are sending data after filling up a form or sending login id and password.
What is doGet and doPost method return?
The doGet() method is used for getting the information from server while the doPost() method is used for sending information to the server.
What is the life cycle method of JSP?
As you know, JSP page is first converted into an equivalent Servlet program, so life cycle method of JSP is same as Servlet life-cycle method. But Sun Microsystems has given three life-cycle convince methods as alternatives to original life-cycle methods.
What is the difference between life cycle methods and helper methods?
The method that is called by container automatically and directly when event is raised is called life cycle method. The methods which are called internally from this life cycle methods are called life cycle convince helper methods.
What is a JSP?
It can be defined as the procedure of origination till destruction, including all the phases a JSP follows. Further, we will discuss- Discussion of each stage in detail.
How to clean up of JSP using Servlet?
Servlet container calls the _jspService () for processing the request Clean up of the JSP, here servlet container will call jspDestroy () method. Now let’s elaborate on the above-mentioned steps to have a clearer picture: