aatifansari / GET-vs-POST

An illustrative project to show how data is send to the server using GET and POST methods

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GET-vs-POST

An illustrative project to show how data is send to the server using GET and POST methods

The application start from index.jsp file. The default welcome file for https://{host_name}/SimpleServlet context path.

  • WELCOME PAGE

image

Two method are given to pass data to the server

  • Submit Form using GET method
  • Submit Form using POST method

Selecting any option opens a simple form page

image

a). When GET method is used user is given warning that it's credential is visible in the URL

image

URL

image

b). When POST method is used data is passed in the body so the secret is safe!!

image

GET Method -

  • Parameters are passed in the URL therefore it should not be used when dealing with sensitive data
  • GET request can be bookmarked
  • GET requests remain in the browser history

POST Method -

  • Parameter are passed in the request body therefore used when dealing with sensitive data
  • POST cannot be bookmarked
  • POST request do not remain in the browser history
  • POST requests have no restrictions on data length.

Used deployment descriptor file to map FormServlet to SimpleServlet/submittedForm context path.

image

IMPORTANT NOTES

  • web.xml file directory - src/main/webapp/WEB-INF
  • jsp pages directory - src/main/webapp

Tools and Technologies

  • Java
  • Servlet
  • JSP
  • Maven

About

An illustrative project to show how data is send to the server using GET and POST methods


Languages

Language:Java 100.0%