Java Server Page (JSP) is a serverside program that is similar in design and functionality to JAVA Servlet . JSP program consists of a compination of HTML tags and JSP tags. JSP tags define Java code that is executed before the output of the JSP progam is sent to the browser.
How JSP functions or Lifecycle of JSP?
When a client requests a jsp , First time JSPs are converted into servlets and then compiled before they get executed. The code inside the JSP gets placed into the converted servlets service() method.
JSP has three methods which is automatically called when a JSP is requested.
1. jspInt() 2. jspDestroy() 3. sevice()
1. jspInt() : similar to init() method of a Servlet :- when a JSP is requested , jspInt() is called first.
2. jspDestroy() : similar to destroy() method of a servlet :- automatically called when a JSP terminates. can be used to cleanup the resources used during the execution (eg. disconnecting from database )
3. service() : similar to service() method :- automatically called and makes HTTP connection.
How JSP Functions ? Lifecycle of JSP .
Labels:
interview,
j2ee,
JSP,
JSP Interview
0 comments:
Post a Comment