JSP Hosting
 

HostingServicesSupportOrderAbout UsSoftwareHome


Even experts read the manuals. Our tech support staff has most of the books that are out on a wide variety of web topics. Here are some of their top picks. We think you'll find them useful and informative as well.



Servlet Initialization Parameters

With Tomcat, init arguments are defined in the web.xml file which should be placed in the WEB-INF directory. This file contains definitions for servlet aliases and init parameters and values. Following is an example of a single servlet entry with an alias (MyServlet) and two initialization parameters:

<servlet>
 <servlet-name>
    MyServlet
 </servlet-name>
 <servlet-class>
    com.mmaweb.MyClass
 </servlet-class>
 <init-param>  
 <param-name>    
    InitArg1
 </param-name>
 <param-value>
    Value1
 </param-value>
 </init-param>
 <init-param>  
 <param-name>    
    InitArg2
 </param-name>
 <param-value>
    Value2
 </param-value>
 </init-param>
</servlet>

Servlet Name Mapping

In addition to initialization parameters, you may want to map your servlet class to a different name. This lets you call a servlet by YourName instead of com.somecompany.servlets.OurClass. This can be done with the servlet-mapping in the web.xml file. To continue the example from above, the following servlet-mapping would map the class com.mmaweb.MyClass to the URL http://www.somehost.com/servlet/Simple

<servlet-mapping>
<servlet-name> MyServlet </servlet-name> <url-pattern> /servlet/Simple </url-pattern> </servlet-mapping>

If you add new servlet entries, make sure you place them outside any existing servlet entries in the web.xml file. You will need to restart your Tomcat VM when web.xml file changes are made.

<-- Previous

Note: MMA technical support staff cannot provide troubleshooting of problems with third-party CGI scripts including but not limited to: Perl scripts, C/C++ binaries, PHP or web/database integration unless these services are specifically contracted. For these services, please see our Quote Request Form.



Copyright © 1995-2012
Motivational Marketing Associates, LLC
All Rights Reserved.