• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with URL-PATTERN tag

 
mithun gooty
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic