wood burning stoves 2.0*
The moose likes Servlets and the fly likes SERVLET MAP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "SERVLET MAP" Watch "SERVLET MAP" New topic
Author

SERVLET MAP

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
hello
my server.xml:
........
........
<Context path="" docBase="C:\jakarta-tomcat-4.0\webapps\FreakServlet" debug="0"/>
........
........

my web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<servlet-name>freak</servlet-name>
<servlet-class>FreakServlet</servlet-class>
<init-param>
<param-name>waitInterval</param-name>
<param-value>5</param-value>
</init-param>
</servlet>
<!--
<error-page>
<exception-type>javax.servlet.UnavailableException</exception-type>
<location>/unavailable.html</location>
</error-page>
-->
<servlet-mapping>
<servlet-name>freak</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

</web-app>


if i specify "http://localhost:8080/" in my browser,it don't work.
but if i specify "http://localhost:8080/servlet/freak",it works well,why?
what i mean is to map "C:\jakarta-tomcat-4.0\webapps\FreakServlet" to the web root.
help me!
Al Green
Greenhorn

Joined: Feb 09, 2002
Posts: 10
Try mapping explicitly to the root, such as:
servlet-mapping>
<servlet-name>freak</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
hello
thanks.it work,would you like to give me some explanation?because in my other applications,i use the "/*" to map servlet,they all works well,only this one fail to work,why?
otherwise i modify the "web.xml" as follow:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<servlet-name>freak</servlet-name>
<servlet-class>FreakServlet</servlet-class>
<init-param>
<param-name>waitInterval</param-name>
<param-value>5</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>freak</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>javax.servlet.UnavailableException</exception-type>
<location>/unavailable.html</location>
</error-page>

</web-app>

when the UnavailableException(Http status 503) appears,it can't direct to the error page(unavailable.html),why?any wrong with the "web.xml"?
help me please!
thank you very much.
 
Don't get me started about those stupid light bulbs.
 
subject: SERVLET MAP
 
Similar Threads
when tomcat know "*" as "any"?
Deploying the application
Tomcat Cannot Find The properties File
Need help with web.xml file
Servlets with Tomcat 4