camilajenny
camilajenny

Reputation: 5034

Why URL mapping for tomcat has to have application name inside?

When I deploy an application named let's say App with a servlet Servlet with tomcat, then I can access it using URL localhost:8080/App/Servlet. Why not localhost:8080/Servlet? Can I configure it so that /Servlet redirects to /App/Servlet?

Upvotes: 0

Views: 91

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48057

Just deploy your web application with the special name ROOT.

That'll be either in tomcat/webapps/ROOT or tomcat/webapps/ROOT.war (unless you deploy in a different way). Note: If memory serves me right, then those have to be capital letters for ROOT, even on Windows

Another option is to bring the configuration into Tomcat's context.xml, in your web-application's META-INF/context.xml (see "path" in the docs)

Upvotes: 1

Related Questions