Configuring Servlets
You define servlets as a part of a Web application in several entries in the J2EE standard Web Application deployment descriptor, web.xml. The
web.xml
file is located in the WEB-INF
directory of your Web application. The first entry, under the root
servlet
element in web.xml, defines a name for the servlet and specifies the compiled class that executes the servlet. (Or, instead of specifying a servlet class, you can specify a JSP.) The servlet
element also contains definitions for initialization attributes and security roles for the servlet. The second entry in web.xml, under the
servlet-mapping
element, defines the URL pattern that calls this servlet. Servlet Mapping
Servlet mapping controls the way you want to access your servlets
example of servlet mapping look like the image i attatched above
Servlet Initialization Attributes
You define initialization attributes for servlets in the Web application deployment descriptor, web.xml, in theinit-param
element of the servlet
element, using param-name
and param-value
tags. The web.xml
file is located in the WEB-INF
directory of your Web application. For example i am attaching the image .this will clear thedoubt
i will come advanced feature of the Servlets in my second post
Comments
Post a Comment