Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with web.xml: url-pattern

 
Alex Joyce
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.. \0/

I have a question, would appreciate any help anyone can offer.

My servlet is placed here:

WEB-INF/classes/image_servlet/ImageServlet.class

Deployed in Tomcat 5.0 at context path: /ImageEncrypt

Here is the web app element of my web.xml, I think it must be incorrect?

<web-app>
<display-name>Image Encrypt</display-name>
<servlet>
<servlet-name>ImageServlet</servlet-name>
<servlet-class>ImageServlet </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ImageServlet</servlet-name>
<url-pattern>/image_servlet/ImageServlet</url-pattern>
</servlet-mapping>
</web-app>


Do I need to add the context path to url-pattern?
Could someone tell me if this is correct?

Many thanks.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alex Joyce:
<web-app>
<display-name>Image Encrypt</display-name>
<servlet>
<servlet-name>ImageServlet</servlet-name>
<servlet-class>ImageServlet </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ImageServlet</servlet-name>
<url-pattern>/image_servlet/ImageServlet</url-pattern>
</servlet-mapping>
</web-app>


- Remove space in "Image Encrypt" like "ImageEncrypt".
- Your servlet-class should be a fully qualified name like, com.servlet.ImageServlet
- According to the naming convention change "image_servlet" to "servlet" or "imageservlet"
[ March 17, 2005: Message edited by: Adeel Ansari ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic