• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SERVLET MAP

 
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 416
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic