my dog learned polymorphism*
The moose likes Tomcat and the fly likes Problem with URL-PATTERN tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem with URL-PATTERN tag" Watch "Problem with URL-PATTERN tag" New topic
Author

Problem with URL-PATTERN tag

mithun gooty
Ranch Hand

Joined: Mar 14, 2006
Posts: 33
I have problem giving the url-pattern information in web.xml file. I have a created a servet ServletExample and the url-pattern entry for this servlet looks like this:

<servlet>
<servlet-name>ServletExample</servlet-name>
<servlet-class>ServletExample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletExample</servlet-name>
<url-pattern>/ServletExample</url-pattern>
</servlet-mapping>

The servlet class is directly under the classes folder. When i try to run this servlet from Tomcat with http://localhost:8080/PostServlet URL, I get the following error:

The requested resource (/ServletExample) is not available.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41117
    
  45
The URL seems is missing the name of the web app; it should be something like http://localhost:8080/MyWebApp/PostServlet. Or are you modifying the ROOT context? I wouldn't recommend that.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with URL-PATTERN tag
 
Similar Threads
RequestDispatcher and Blank Page
web.xml within tomcat
question related to servlet class and how to run it from Root
How to run servlet on Tomcat
Running Servlets, have a question