Introduction to Servlets

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so welcome back areas this is have enjoyed some very solid links in this video we'll talk about how sublet work so just imagine we have a client machine there and we have a server right so when you talk about this website world or this web world so a client sends a request to the server expecting a page right again you can even ask for anything on internet but let's say you're asking for a page now now this page can be a static page it can be a tenant page when it's a static it means which is already made and when you say dynamic it means it will be built at one time so let's say a client sends the request which is a study request which goes our server on your server you already have a file right so that file goes to declined requests online so we called a request on response finish right but let's say if you are asking for a page which is different which is from the beaches which will be billed as one time so a client sends a request to the server now services hold on I don't have any page with this with this length so you have to make that page right you have to build a page so that request goes to a helper application then you see I think we got in the helper application on the server now this helper application is also called as web container okay so we in this web container you will be having soft light nowadays subject subject is basically a Java file which can take the request from the client on the internet and it can process that request it can provide you a response in the format of HTML page like so this sublet will convert your request and it will take your request to stretch the values it will process the information and it will send the HTML page right so let me just go back once again some client-side VIX which goes to server on the server side since it is a dynamic request it will go to your web container which is so whatever weapon terms we have so we have a tomcat we can also use glass which we can use JBoss we can use WebSphere in fact all these other servers those are called as app servers but they also have a feature of web server so basically we always use Tomcat in fact in my videos you will find all the things inside using Tomcat right so that Tomcat is a web container so on your server if you want to achieve that where the dynamic web web pages you need to install Tomcat ok so you can see that is Tomcat there so judge web content is a tomcat so when request goes to your tomcat Tomcat States hold on I got a request now but that request is for ABC dot HTM and if you don't have any pages it on the screen right so we have to build that page so that request goes to a servlet hold on solids will be having a Java name right example when you create Java classes let's say I want to add two numbers again a basic example is going to add two numbers I will be having so I will be having the sublet name as add sublet that means when a request for a TC dot HTM the page which should be getting called is your servlet how can we do that so what we have is within your entire center instead of container you have a special file which is called as deployment descriptor and this is outlook so you have a file you do deployment descriptor in which you mentioned for which request which server should be called ok so let's say in our in I mean in your Tomcat server you have maybe 50 to 60 servlet so every servlet will be mentioned I mean every request live map with one sublet it may happen that you mean you have multiple requests trying to access the same sublet right everything need to be configured in a file which is called as deployment descriptor and the file name is web dot xml so this file here is your web dot xml file so let me repeat when clients of the request which goes to the server now server thanks ok this is the next page let's send a request to the web container now West container will check ok this is this request will be mapped by this public that can be done with the help of web dot XML file so you can seem to affect XML files we have two tags we have sublet tags and we have service mapping tags so the service tags you have to mention the class name and in your service mapping tag you have to mention the you are those patches so for this URL we need to call that particular but hold on how do we get us off this now and that's very simple you can see we have a file here so this is this is your file structure so when you want to create a servlet it's a normal class okay which extends HTTP servlet since we want to sublet features like we can estate normal for Joe which is a normal glass we have to create a special class which extends HTTP servlet because this HTTP servlet will provide you all the features which you need okay now when I say all these features it means it should be able to take you from this equation of this server it should be processing the request and it should be sending the response how it will be done that will be in the next video but it's take the request its purpose the information and it will send the response now that respond will be in HTML form eyes again you can send a response in JSON format or an almost string you can send a response in XML format you can also send the response in the HTML format now that HTML speed this is which is a dynamic page goes from your server to your client must read in the format of response object right so now we have one more thing right we have web web personal file here do we have a replacement for that because the column is be our job or graminoid and we don't like xml that's not in the case but we but let's say we try to avoid xml now how do we avoid xml so in this subject 3.0 we got a new feature which is called as annotation so we can use annotations on your sublet so you don't have to use XML file or graduation one file you can you can do your mapping using annotations I can how - done that is done that we'll see in the subsequent tutorials but this is how your service basically work with the Tomcat server ok so a quick recap we have a client machine visualize equation console server from the server request goes to your web container web container uses a file called as web dot XML to detect which serve it to call and it calls itself that that sublet will go to the information and it will send the response to the client machine that'll judge that's how it works in the next video we'll talk about how that how exactly your container searches for the tablet and how its get loaded and the life cycle of the subject thank you so much and do subscribe for the video
Info
Channel: Telusko
Views: 830,730
Rating: undefined out of 5
Keywords: telusko, navin, reddy, tutorial, java, servlets, servlets Graphical representation, static page, dynamic page, server, java file, client request to server, helper application, web container, how servlet works, servlet tag, servlet sending respond in html format
Id: 7TOmdDJc14s
Channel Id: undefined
Length: 6min 50sec (410 seconds)
Published: Thu Feb 02 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.