Deployment Discriptor-web.xml

Deploying a Servlet...


Servlets are deployed in two ways... Implicate the servlet in the web.xml file by adding a section like...

<servlet>
   <servlet-name>GetPage</servlet-name>
   <servlet-class>com.leistware.servlet.GetPage</servlet-class>
   <init-param>
      <param-name>pageid</param-name>
      <param-value>00-15-9C</param-value>
   </init-param>
   <load-on-startup>1</load-on-startup>
</servlet>

...OR use a servlet annotation in the servlet class file like...

@WebServlet(name = "GetPage", urlPatterns = {"/GetPage"})

Last thing... if this servlet should be fired first, from the context root, add it to the Welcome File list...

<welcome-file-list>
   <welcome-file>GetPage</welcome-file>
</welcome-file-list>

CREATED 2012-12-30 08:53:19.0

00-19-0E

UPDATED 2012-12-30 08:53:39.0

By The Way...


One thing not to do... configure your servlet as the default... this will NOT work. The default servlet in Tomcat does a couple of things. For one... it serves up directory listings (which is not a very secure thing to do unless there are no files with sensitive information in them) So if you configure the servlet like this....

<servlet>
   <servlet-name>MyServlet</servlet-name>
   <servlet-class>com.leistware.servlet.MyServlet</servlet-class>
   <init-param>
      <param-name>param1</param-name>
      <param-value>Will work for food</param-value>    </init-param>
   <load-on-startup>1</load-on-startup>
</servlet>

...do not map it like this...

<servlet-mapping>
   <servlet-name>MyServlet</servlet-name>
   <url-pattern>/ </url-pattern>     <-- this is the problem
</servlet-mapping>

...this will cause all kinds of intermitant problems, like the style sheets will not render.

CREATED 2012-12-30 16:14:14.0

00-19-17

UPDATED 2012-12-30 16:14:20.0

Knowledge

L
I
N
K
S

DBID: db.wam

Page Server: Ithica

©2012 Leistware Data Systems

      Hello anonymous