JSP
JSP is a technology for developing web pages that support dynamic content which helps developers insert java code in HTML pages by making use of special JSP tags, most of which start with <% and end with %>.
A Java Server Pages component is a type of java Servlet that is designed to fulfil the role of a user for web application.
Using JSP, we can separate business logic from presentation(View) logic. Also, using JSP we can collect input from the user through web page forms, present records from a database, and create web pages dynamically. In these all situations mainly we will use JSP.
Life Cycle of JSP?
JSP have three life cycle methods, jspInit(), jspService(), jspDestroy(). You can override jspInit() and jspDestroy() methods. But, you don't override jspService() method. In the below diagram represents the completed JSP life cycle,
Compilation: After translating to a servlet. It gets compiled and create class file for servlet.
Initialization: After successfully creating a class file, JSP engine will call jspInit() to initialize class file.
Service: After initialization, service(jspService()) method is called and it handles the request and create response to be delivered to browser.
Destroy: Once the service is completed and response is sent back, jspDestroy() method is called and it will clean up the resources.
A Java Server Pages component is a type of java Servlet that is designed to fulfil the role of a user for web application.
Using JSP, we can separate business logic from presentation(View) logic. Also, using JSP we can collect input from the user through web page forms, present records from a database, and create web pages dynamically. In these all situations mainly we will use JSP.
Life Cycle of JSP?
JSP have three life cycle methods, jspInit(), jspService(), jspDestroy(). You can override jspInit() and jspDestroy() methods. But, you don't override jspService() method. In the below diagram represents the completed JSP life cycle,
[Image Not Loading]
Translation: When a request is sends to server first time and server identifies right resource(JSP) to handle a request. JSP is first translated to a Servlet. Compilation: After translating to a servlet. It gets compiled and create class file for servlet.
Initialization: After successfully creating a class file, JSP engine will call jspInit() to initialize class file.
Service: After initialization, service(jspService()) method is called and it handles the request and create response to be delivered to browser.
Destroy: Once the service is completed and response is sent back, jspDestroy() method is called and it will clean up the resources.
Comments
Post a Comment