Presentation is loading. Please wait.

Presentation is loading. Please wait.

21/12/20151 T h i s p r e s e n t a t i o n w i l l p r o b a b l y i n v o l v e a u d i e n c e d i s c u s s i o n, w h i c h w i l l c r e a t e a.

Similar presentations


Presentation on theme: "21/12/20151 T h i s p r e s e n t a t i o n w i l l p r o b a b l y i n v o l v e a u d i e n c e d i s c u s s i o n, w h i c h w i l l c r e a t e a."— Presentation transcript:

1 21/12/20151 T h i s p r e s e n t a t i o n w i l l p r o b a b l y i n v o l v e a u d i e n c e d i s c u s s i o n, w h i c h w i l l c r e a t e a c t i o n i t e m s. U s e P o w e r P o i n t t o k e e p t r a c k o f t h e s e a c t i o n i t e m s d u r i n g y o u r p r e s e n t a t i o n I n S l i d e S h o w, c l i c k o n t h e r i g h t m o u s e b u t t o n S e l e c t “ M e e t i n g M i n d e r ” S e l e c t t h e “ A c t i o n I t e m s ” t a b T y p e i n a c t i o n i t e m s a s t h e y c o m e u p C l i c k O K t o d i s m i s s t h i s b o x T h i s w i l l a u t o m a t i c a l l y c r e a t e a n A c t i o n I t e m s l i d e a t t h e e n d o f y o u r p r e s e n t a t i o n w i t h y o u r p o i n t s e n t e r e d. SSS By, Kshirsagar Harshada Mangesh. Third Year Computer Government Polytechnic, Pune.

2 21/12/20152 What are Servlets? What are Servlets? Why are Servlets? Why are Servlets? How are Servlets? Why not CGI? When are Servlets? When are Servlets? Where are Servlets? Where are Servlets? Some Questions In your Mind …. Servlets Kshirsagar Harshada Mangesh

3 21/12/20153 Concepts Internet : network of networks WWW (World Wide Web) also referred to as web : - One of the largest Internet services - Consists of millions of websites

4 21/12/20154 How web works Web Browser Web Server URL Browser requests A web page WebServer sends back the requested page Uniform Resource Locator which specifies the location of the webpage on the webserver http://www.rediff.com/index.html Stores the WebPages & sends them to the browser upon a request

5 21/12/20155 Serving static HTML page Web Server Browser requests A web page WebServer sends back the requested page Initially web servers were designed to provide the static WebPages HTML page WebPages On Hard Disk

6 21/12/20156 Servlets Kshirsagar Harshada Mangesh

7 21/12/20157 Servlets Kshirsagar Harshada Mangesh

8 21/12/20158 Servlets Kshirsagar Harshada Mangesh

9 21/12/20159 Servlets Kshirsagar Harshada Mangesh

10 21/12/201510

11 21/12/201511

12 21/12/201512

13 21/12/201513

14 21/12/201514 a soultion for dynamically generating HTML Servlets are small platform-independent server- side programs that extend the functionality of a webserver It is a java class which run on the webserver and communicate with the web browser using HTML & HTTP A no of servlets can form a website. Servlets Kshirsagar Harshada Mangesh

15 21/12/201515  But web consists of millions of websites( comprising of billions of webpages linked together using hyperlinks) So there require someone to host these websites & map web applications to servlets. This task of hosting servlets & web applications is done by Servlets Kshirsagar Harshada Mangesh

16 21/12/201516 Architecture of a Servlet (Request-Response Flow) Web Browser Web Server HTTP Request HTTP Response Mapping information Web Application Web Container Static resources Servlets Static resources

17 21/12/201517 init() destroy() Servlet 3 distinct phases Birth Life Death service()

18 21/12/201518 init() method called before the servlet handles its first request The container passes ServletConfig Object contaning the initialization parameters to this method If overridden must call super.init() first public void init(ServletConfig config)throws SerletException { }

19 21/12/201519 service() method Each time the server receives a request for a servlet,it spawns a new thread & calls the service method It is the entry point for executing application logic in a servlet Web Server Browser service() Single Instance Of the servlet public void service(ServletRequest request,ServletResponse response) { }

20 21/12/201520 destroy() method - is called at servlet unloading - all cleanup activities can be done here (closing db/socket connections,updating log files) public void destroy() { }

21 21/12/201521 There are 2 steps in order to build & deploy a servlet-based application (A) Development Phase : - Write the servlet class with the required application logic - Compile the servlet class (B) Deployment Phase : - Deploy the servlet in the webserver

22 21/12/201522 Redirection At times outdated/old URLs need to be redirected to new ones so that the user does not see an error when the URL is accessed In such situations,URL redirection option allow us to forward the request to new location Several situations in which the URL needs to be changed - when the document moves to new URL - when the application is enhanced to include more pages - when the user goes to final order page w/o filling the requisite order details URL redirection can be achieved by using (A) sendRedirect method of HttpServletResponse interface (B) forward method of RequestDispatcher interface “ redirect ” means sending response from servlet to the browser telling it to go to another URL

23 21/12/201523 Conclusion

24 21/12/201524

25 21/12/201525 Question & Answers ? ?

26 21/12/201526 Java on Server-side Robust Scalable Open Fast Portable Well integrated Extensible & flexible

27 21/12/201527 Advantages over other techniques Generally much faster than CGI scripts A different process model is used. Standard API Supported by many web servers. All the advantages of the Java --Ease of development --Large API

28 21/12/201528 Session Tracking

29 21/12/201529 Why are Servlets? Static Webpages Dynamic Webpages


Download ppt "21/12/20151 T h i s p r e s e n t a t i o n w i l l p r o b a b l y i n v o l v e a u d i e n c e d i s c u s s i o n, w h i c h w i l l c r e a t e a."

Similar presentations


Ads by Google