This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Help with web.xml: url-pattern
 
Similar Threads
Servlets on APACHE/JBOSS not working
Web.xml - ByPass security
s:excelExport Exception in PhaseListener
Path Not Reaching Servlet
Problem with web.xml (WebLogic Server 8.1 SP2) ?