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 servlet mapping 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 "servlet mapping" Watch "servlet mapping" New topic

servlet mapping

Ionut Barau

Joined: Feb 18, 2008
Posts: 20
Hi.I am new to Servlets and i have a question about servlet mapping.Does <url-pattern> in web.xml have to be the same as the path of the request? Can the path in <url-pattern> point to another location? or it has to be the same as the location of the jsp that requests for the servlet that I am mapping?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60810

Not sure what you are asking. The URL pattern can be whatever makes sense and doesn't conflict with the other patterns.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Venkata Kumar
Ranch Hand

Joined: Apr 16, 2008
Posts: 110

see this link for information about web.xml tags

use of url patterns is explained in servlets specification

SCJP 5.0, SCWCD 5, preparing for SCDJWS
It is sorta covered in the JavaRanch Style Guide.
subject: servlet mapping
Similar Threads
Path Not Reaching Servlet
Dount in web.xml
STRUTS - Invalid path
Why two places to define link in servlet class and url-pattern
Problem with web.xml (WebLogic Server 8.1 SP2) ?