File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SERVLET MAP