Servlets and JSPs

  • A Web server takes a client request and give something back to the client.
  • A web client lets the user request something on the server, and shows the user result of the request.
  • HTML - HTML tells the browser how to display the content to the user.

HTTP is the protocol clients and serves use on the web to communicate.

What is the HTTP protocol ?

  1. HTTP runs on top of TCP/IP. The structure of an HTTP connversation is a simple Request/Response
  2. The key elements of the request stream:
  3. HTTP method (the action to be performed)
  4. The page to access (URL)
  5. Form parameters
  6. Key elements of the response stream
  7. Status Code
  8. Content Type
  9. Content
  10. GET/POST
  11. GET is the simplest HTTP method, and it’s main job in life is to ask the server to get a resource and send it back.
  12. POST is more powerful request. It’s like GET plus plus. With POST you can request something and at the same time send form data to the server.

Reasons you might use POST instead of GET

  1. The total amount of characters in a GET is really limited
  2. The data you send with the GET is appended to the URL

Anatomy of an HTTP GET request

Two things the web server alone won’t do

  • Dynamic Content
  • Saving data on the server

JSP is what happened when somebody introduced Java to HTML

  1. Not all HTML page designer know Java
  2. Formatting HTML into a String literal is REALLY ugly