This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Servlets and the fly likes Mapping problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Mapping problems" Watch "Mapping problems" New topic

Mapping problems

Mike Phillip
Ranch Hand

Joined: Dec 05, 2007
Posts: 37
Hi, I trying to do an web app, and I'm having problems with the servlet mapping settings.

I that when the user hits http://localhost:8080/myapp/
it goes do the servlet I mapped, and it will redirect to a jsp file.

So I did:


it seems to work fine,

but is this the right way to map the first page to and servlet? could I do with a <welcome-file>

And if I have other servlets, and put other mapping, will they be affected by this patter?

Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
There is no harm in the you choose to do the mapping. Similar behavior can be achieved by setting welcome file as well. When you configure more servlets they won't impact the existing ones as every servlet is required to have a unique URL pattern. Two servlets can not have same URL pattern though one servlet can serve many URL patterns.

My Blog
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
And the closest URL pattern will win.
Mike Phillip
Ranch Hand

Joined: Dec 05, 2007
Posts: 37
thanks guys, really helpful
It is sorta covered in the JavaRanch Style Guide.
subject: Mapping problems