1 Chapter 6 Servlets and JSP Advanced Programming
2 Objectives At the end of this chapter, you will be able to learn: HTML HTTP Webserver Servlets and its Architecture Servlet API Servlet Life Cycle Session Tracking JSP Overview
3 HTML Hyper-Text Markup Language Defines tags and formatting's Basic Html document <html> <head> <title> Html Doc </title> </head> <body> <h1> Html is awesome </h1> </body> </html> Html document can be formatted using CSS- cascading style sheet
4 Web Server A web server is a program running on the server that listens for incoming requests and services those requests as they come in. Once the web server receives a request, depending on the type of request the web server might look for a web page, or it might execute a program on the server. It will always return some kind of results to the web browser, even if its simply an error message saying that it couldn’t process the request. By default the role of a web server is to serve static pages using the http protocol Web servers can be made dynamic by adding additional processing capability to the server 4
5 HTTP HyperText Transfer Protocol Stateless request/response client-server protocol Requests: Method: GET, POST, HEAD, TRACE, OPTIONS, PUT, DELETE URI (required in HTTP/1.1) Header Fields E.g. how the response should be returned, under what conditions, identification and characterization of client, accounting data Body POST data Empty for GET Response: Status code (machine), reason (human) Header Metadata, e.g. Content-Type (Media type), Content- Length, Last-Modified, Etag
6 Request-response model request response HTTP HTML HTTP Request <html> <head> <body> … <html> <head> <body> … Client Server
7 of 99 7 Three types of tracking methods are used: Cookies: Line of text with ID on the users cookie file URL Session Tracking: An id is appended to all the links in the website web pages. Hidden Form Elements: An ID is hidden in form elements which are not visible to user Dynamic generated html allows the state to be tracked HTTP - Tracking State
8 Server Side programming Web Server Application Server Extensions Web Server machine I can serve only static HTML pages Not a problem. I can handle dynamic requests.
9 9 Several different tools are available for extending the server capabilities Java enterprise architecture( servlet & jsp) ASP.Net architecture PHP CGI-Perl scripting These tools process incoming requests from the user and generate custom html pages Server Extensions
10 Servlets A servlet is a compiled Java class that run server- side under the control of the Web server Servlets are managed by the servlet container , or servlet engine Servlets receive requests and return responses, both of which are supported by the HTTP protocol When the Web Server receives a request that is for a servlet, the request is passed to the servlet container
You've reached the end of your free preview.
Want to read all 40 pages?
- Fall '19
- World Wide Web, Web server, Web browser, container, HTTP cookie, Hypertext Transfer Protocol