Before looking into Servlet and JSP, we will see some important keywords about web application.
Web Client/ Client:
We will call browsers (IE, Chrome, Mozilla etc.) as a Client, which helps in communicating with the server, because using browsers we will send a request to the web Server and ask for a response. Also browser will render the html response which has been received from server.
Web Server is the one which takes the client request, process the request and sends back the response.
When client send a request to a server, it will also send an address and name of the resource it is looking for. The combination of address and name is called URL.
We know server and client (browser) will communicate with each other, this communication is happening with the help of HTTP protocol. HTTP runs on top of TCP/IP Protocol. TCP protocol will ensure that the data are divided into many packets also it will ensure that all packets of data will reach the destination as a complete file. IP protocol will take care of sending those packets over the network. So when a client send a request to the server, it will be HTTP Request and when a server sends a response it will be HTTP Response.
When server sends the response to a client (browsers), it should be displayed in a format in such a way the end user should able to understand the response. So all browsers must know HTML.
When server sends an HTTP response, HTML will be the part of that HTTP response. So when server sends an HTTP response, it will have HTTP Header and HTML Content. So when a browser finds the HTML tag, browser will render the HTML content and displays it to the user.
Get Request and Post Request:
When we send request to a server, it can be either a get request or a post request. We can use get request when we ask for a page or get something from a server. We can send some data along with get request but amount of data send along with request is limited. Also the data which we are going to send will be appended in the URL.
We can use post request if we want to post some data to the server, we can also use it to get some data from server, but mostly it will be used to post data to the server.