Posts

Showing posts from November 16, 2010

JSP Components Declaratives Scriptlets Expressions

JSP Components -     JSP has mainly six type of components. 1. JSP Declaratives 2.JSP Scriptlets 3.JSP Expressions 4.Directives  5.Implicit Objects 6.Standard Actions  JSP Declaratives -        JSP Declaratives is used for embed Java code in class label. Any code which is written in JSP Declaratives will goes to scope of a class of servlet. JSP Declaratives is open with <%! and closed with %> syntax. If any variable is made in JSP Declaratives means this variable will be available for any where with in JSP. Example -     <HTML>          <HEAD>          <BODY>         <%!             public int getSum(int a, int b){                 return a+b;             }         %>           </BODY>     </HTML> Servlet of this JSP will be - package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class test_jsp extends org.apache.jasper.runtime.HttpJspBase     imp

Java Server Page Life Cycle

JSP (Java Server Page) -     JSP means java server page with in the JSP you can write java code with in html code.     Ex -     <html>         <body>         <%             System.out.println(“This is my first JSP Page”);         %>         </body>     </html>     When any request will go for any jsp firstly JSP creates a Servlet for JSP and compiles to .class file then run over the web server. JSP Life Cycle -     There are three methods defines Life Cycle of JSP Page. 1._jspInit() 2._jspService() 3._jspDestroy() _jspInit() Method - _jspInit() method is called by jsp container for initializing the servlet of jsp page. This method is call at one time of any JSP life. _jspService() Method-  _jspService() method is called when any request is send by the client for providing the response on this JSP Page. _jspService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) _jspDestroy() Metho

Recent Post

Recent Posts Widget