This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Help with web.xml:  url-pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Help with web.xml:  url-pattern" Watch "Help with web.xml:  url-pattern" New topic
Author

Help with web.xml: url-pattern

Alex Joyce
Greenhorn

Joined: Feb 17, 2005
Posts: 13
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

Joined: Aug 15, 2004
Posts: 2874
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 ]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Help with web.xml: url-pattern
 
It's not a secret anymore!