Anda di halaman 1dari 30

|  

 
a  a


Ô 
Ô
    
Ô 
Ô    
Ô      

a
 
aa

Ô Introduction to JSP Technology :

Ô       


  
Ô       
   !"#

Ô $   $  
       

Ô
 
aa

Ô [ifferences between servlets and JSP are:


Ô       
       %
$     
!"#
    

Ô   &     


 '       
         
 %$ $   
     $
   
 

D
 

Ô JSP Life Cycle is represented as shown:

 
 

Ô JSP life cycle methods are:

Ô jspInit():        (


Ô jspService():  '   
  
Ô jsp[estroy():   
 

Î
    

Ô The following code shows the sample structure of a JSP Page:

X "  !"#
  
X  )*+* 
X!"#

X!,-X""
,  &X""
,X!,-
X%-.
X!/"         X!/
X "          -
+    
X +  -)+  -012 
X!3X )! 01 X )#  01 X 
) 01 X!3
X%-.
X!"#


A
a a

a  

ë    
 

Ô The three components of a JSP page are:

Ô     
Ô     
Ô    

]
[

Ô         


     

Ô  -   
Ô   -   
Ô    -   

Ô " &      


X  directive attribute=´value´ 

ë
[

Ô The page [irective

Ô -        


  

Ô " &     


X  page attribute_list 

½
[

Ô "       


   

Y   
  

language [     


 

extends [   



 

import        


   

session     


    session
    
  session 

½½
[

       01

Y   
  

£uffer   


     
   £uffer  !"

autoFlush   


   #  
     
 $ 
  autoFlush 
isThreadSafe $ 
   
 

½a
[

       01

Y   
  

errorPage   #%  


 $ &'(

isErrorPage  


   
    
   isErrorPage  

contentType [)  ) 


* +))*,#   
   contentType 
-

½Ô

[[

Ô The include [irective

Ô       


   
Ô      
 
Ô      

Ô " &        
X  include file = ´URLname´ 

½D
 [

Ô The taglib [irective

Ô     


Ô    45  '      

Ô   &     
      
Ô " &         
X  taglib uri=³tag_lib_URI´ prefix=´prefix´ 

½ 
 [

Ô "      


   

Y  
  

uri (  ([    

prefix [    


      

½Î
  



JSP Scripting Elements


Ô ,     !"#

Ô        $ 
Ô [eclarations:      
-     
X  and      
Ô Expressions:        "
 &    &     
X = expression 
Ô Scriptlets:     
   X   " & 
         
X Java code 

½A
  a 

Ô JSP Implicit Objects are:

Ô         


&   

Ô    

½]
  a 

Ô "        + 

    
  

application javax.servlet.Servlet      .


Context   & #
  . 

config javax.Servlet.Servlet '   


Config ServletConfig  

exception java.lang.Throwa£le ' $  


 
 

½ë
  a 

Ô "        + 

    
  

out javax.servlet.jsp.Jsp '   JspWriter  


Writer   
JspWriter PrintWriter
  #
  
 

page java.lang.O£ject '  



   
   
 

session javax.servlet.http.Ht '    


tpSession HttpSession  

a
  a 

Ô "        + 

    
  

response javax.servlet.http.Ht '    


tpServletResponse HttpServletResponse   
 /)(  

request javax.servlet.http.Ht ' 0  


tpServletRequest HttpServletRequest 
     $ 
0

pageContext javax.servlet.jsp.Pag '     



eContext  


  

   

Ô Classes of JSP API

Ô ",-
Ô "  
Ô " &

aa
a[

The Error[ata Class


Ô -   
Ô      $ ,   $  
 
Ô Contains various methods, which are:
Ô getRequestURL(): 5 ' 45
 
 
Ô setServletName(): 5   
 
Ô getStatusCode(): 5    
 
Ô getThrowable(): 5 "&    



 

Ô The JspWriter Class


Ô      
Ô 5+       $ 
Ô Contains various methods, which are:
Ô 01
Ô 01
Ô  01
Ô   (01
Ô  01
Ô  01

aD
a


Ô The PageContext Class


Ô   &      
 
Ô    $ 
Ô 01
Ô  01
Ô 5' 01
Ô 501
Ô  01
Ô &01
Ô  01
Ô   01

  a
  

Ô Steps to Create a JSP Application


Ô Create a user interface using HTML:    
"   '  
Ô Create a JSP page:      
' !"#
    $ 
 
Ô Package the user interface and JSP page:  !"#

            
Ô [eploy the package you have created: -  
  03,,/61    
 
Ô Access the application using a Web browser:   
    


 

[   
  
ÔProblem Statement
Ô $ "  % 0"%1 
     
     
       "   
  ! 
   $    
       $
          
   
   $
         
  
         
 $    

aA
a[

[   
  +ë ,
Ô Solution
Ô " $ 
/ 
  4 !"#

3     4  
7 , 4  
6     
8 -    
9     

a]
  

V