Unit-8 Servlets.pptx - Servlets Java Servlets and common gateway interface(CGI Programming The life Cycle of a Servlet Using Tomcat for Servlet

Unit-8 Servlets.pptx - Servlets Java Servlets and common...

This preview shows page 1 - 12 out of 56 pages.

Image of page 1
Java Servlets and common gateway interface (CGI) Programming, The life Cycle of a Servlet, Using Tomcat for Servlet Development, A simple java Servlet, the javax. servlet Package, the javax. servlet. http Package, Anatomy of a Java servlet, Reading data from a Client, Reading HTTP Request Headers , Sending data to a client and writing the HTTP response Header, Working with cookies, Tracking sessions
Image of page 2
Java Servlets are programs that run on a Web or Application server and act as a middle layer between a requests coming from a Web browser or other HTTP client and databases or applications on the HTTP server. Explicit/Implicit Data Sent from client to server-side program Processed Return Explicit data 1. Explicit Data: Infromation received from client 2. Implicit Data: HTTP Servlet API Javax.servlet Javax.servlet.http
Image of page 3
Image of page 4
1. For each request, it starts a new process. 2. If number of clients increases, it takes more time for sending response. 3. For each request, it starts a process and Web server is limited to start processes. 4. It uses platform dependent language e.g. C, C++, perl.
Image of page 5
Image of page 6
Image of page 7
Java Servlets & common gateway interface (CGI) Programming, Java Servlets often serve the same purpose as programs implemented using the Common Gateway Interface (CGI). But Servlets offer several advantages in comparison with the CGI. Performance is significantly better. Servlets execute within the address space of a Web server. It is not necessary to create a separate process to handle each client request. Servlets are platform-independent becaus e they are written in Java. Java security manager on the server enforces a set of restrictions to protect the resources on a server machine. The full functionality of the Java class libraries is available to a servlet. It can communicate with applets, databases, or other software via the sockets and RMI mechanisms
Image of page 8
Java Servlets avoids inefficiencies: By loading a single copy of Java Servlet into JVM Java Servlet has persistence: It remains alive , as the request is fulfilled.
Image of page 9
Web Server (Application Logic) Database/ FileSystem (Persistent Storage) Application/Browser (User Interface) 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
Image of page 10
11 Tomcat is a stand alone web server and a servlet container It is open source and free for usage It is written in Java You do not have to be a Java programmer to use it
Image of page 11
Image of page 12

You've reached the end of your free preview.

Want to read all 56 pages?

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes