Skip to main content

Posts

Showing posts from May, 2009

Creating and Configuring Servlets

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 the ini