Servlets Intro
Servlets Intro
Introduction to Servlets
-- Dynamic content means : user will ask for particular details in the
database, upon that server will process user request and response
appropriately by handing user required data from database.
Eg. Online Banking Systems, Online Reservation System.
Java Servlet technology
3. Servlets are most commonly used with http hence also known as
http Servlets.
5. Supported by virtually all web servers and web browsers.
12. When a user issues a request via a URL, the Java servlet classes
convert it to an HttpServletRequest and send it to the target pointed
to by the URL.
13. When the server side has done its work, the JRE put the results
in an HttpServletResponse and then sends it back to the client.
Servlet Container
Servlet container or Servlet Engine provide an execution
environment for Servlets and manage Servlets life cycle from
creation to destroy phase.
Why servlet?
Servlets are loaded into memory once and they can run from
memory thereafter.
Steps:
1. Create Servlet
2. Compile servlet
3. Create deployment descriptor (web.xml)
Web Container gets the information about the servlet to be
invoked.
<web-app> represents the whole application.
<servlet> is sub element of <web-app> and represents the servlet.
<servlet-name> is sub element of <servlet> represents the name of the servlet.
<servlet-class> is sub element of <servlet> represents the class of the servlet.
<servlet-mapping> is sub element of <web-app>. It is used to map the servlet.
<url-pattern> is sub element of <servlet-mapping>. This pattern is used at
client side to invoke the servlet.