×
WORK HARD IN SILENCE; LET SUCCESS MAKE THE NOISE
--Your friends at LectureNotes
Close

Note for Java Programming - JAVA By subham Kumar sah

  • Java Programming - JAVA
  • Note
  • 186 Views
  • 2 Offline Downloads
  • Uploaded 5 months ago
Subham Kumar Sah
Subham Kumar Sah
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

Gopal Pd Sharma,Lecturer,PUSET Servlet Tutorial Servlet technology is used to create web application (resides at server side and generates dynamic web page). Servet technology is robust and scalable as it uses the java language. Before Servlet, CGI (Common Gateway Interface) scripting language was used as a server-side programming language. But there were many disadvantages of this technology. We have discussed these disadvantages below. There are many interfaces and classes in the servlet API such as Servlet, GenericServlet, HttpServlet, ServletRequest, ServletResponse etc. What is a Servlet? Servlet can be described in many ways, depending on the context.      Servlet is a technology i.e. used to create web application. Servlet is an API that provides many interfaces and classes including documentations. Servlet is an interface that must be implemented for creating any servlet. Servlet is a class that extend the capabilities of the servers and respond to the incoming request. It can respond to any type of requests. Servlet is a web component that is deployed on the server to create dynamic web page. What is web application? 1

Text from page-2

Gopal Pd Sharma,Lecturer,PUSET A web application is an application accessible from the web. A web application is composed of web components like Servlet, JSP, Filter etc. and other components such as HTML. The web components typically execute in Web Server and respond to HTTP request. CGI(Commmon Gateway Interface) CGI technology enables the web server to call an external program and pass HTTP request information to the external program to process the request. For each request, it starts a new process. Disadvantages of CGI There are many problems in CGI technology: 1. If number of clients increases, it takes more time for sending response. 2. For each request, it starts a process and Web server is limited to start processes. 3. It uses platform dependent language e.g. C, C++, perl. Advantage of Servlet 2

Text from page-3

Gopal Pd Sharma,Lecturer,PUSET There are many advantages of Servlet over CGI. The web container creates threads for handling the multiple requests to the servlet. Threads have a lot of benefits over the Processes such as they share a common memory area, lighweight, cost of communication between the threads are low. The basic benefits of servlet are as follows: 1. better performance: because it creates a thread for each request not process. 2. Portability: because it uses java language. 3. Robust: Servlets are managed by JVM so no need to worry about momory leak, garbage collection etc. 4. Secure: because it uses java language.. Servlet Terminology 1. Basics of Servlet 2. HTTP 3. Http Request Methods 4. Difference between Get and Post 5. Anatomy of Get Request 6. Anatomy of Post Request 7. Content Type There are some key points that must be known by the servlet programmer like server, container, get request, post request etc. Let's first discuss these points before starting the servlet technology. The basic terminology used in servlet are given below: 1. 2. 3. 4. 5. 6. 7. 8. HTTP HTTP Request Types Difference between Get and Post method Container Server and Difference between web server and application server Content Type Introduction of XML Deployment HTTP (Hyper Text Transfer Protocol) 1. Http is the protocol that allows web servers and browsers to exchange data over the web. 2. It is a request response protocol. 3

Text from page-4

Gopal Pd Sharma,Lecturer,PUSET 3. Http uses reliable TCP connections bydefault on TCP port 80. 4. It is stateless means each request is considered as the new request. In other words, server doesn't recognize the user bydefault. Http Request Methods Every request has a header that tells the status of the client. There are many request methods. Get and Post requests are mostly used. The http request methods are:        HTTP Request GET POST HEAD PUT DELETE OPTIONS TRACE Description GET Asks to get the resource at the requested URL. POST Asks the server to accept the body info attached. It is like GET request with extra info sent with the request. HEAD Asks for only the header part of whatever a GET would return. Just like GET but with no body. TRACE Asks for the loopback of the request message, for testing or troubleshooting. PUT Says to put the enclosed info (the body) at the requested URL. 4

Lecture Notes