Servlets and JSPs
26 Jul 2012- 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 ?
- HTTP runs on top of TCP/IP. The structure of an HTTP connversation is a simple Request/Response
- The key elements of the request stream:
- HTTP method (the action to be performed)
- The page to access (URL)
- Form parameters
- Key elements of the response stream
- Status Code
- Content Type
- Content
- GET/POST
- 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.
- 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
- The total amount of characters in a GET is really limited
- 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
- Not all HTML page designer know Java
- Formatting HTML into a String literal is REALLY ugly