0
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-    app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee     http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>basic setup</display-name>
<servlet>
 <servlet-name>Faces Servlet</servlet-name>
 <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
 <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
    <welcome-file>/index.faces</welcome-file>
 </welcome-file-list>

It should be accessed from domain like www.example.com without showing www.example.com/basicsetup.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555

1 Answers1

1

It would be wise to go through Tomcat 7 server documentation on the issue, especially the following part, recited below for you (emphasis mine:

The Context element represents a web application, which is run within a particular virtual host. Each web application is based on a Web Application Archive (WAR) file ...

The web application used to process each HTTP request is selected by Catalina based on matching the longest possible prefix of the Request URI against the context path of each defined Context.

You may define as many Context elements as you wish. Each such Context MUST have a unique context name within a virtual host. The context path does not need to be unique (see parallel deployment below). In addition, a Context must be present with a context path equal to a zero-length string. This Context becomes the default web application for this virtual host, and is used to process all requests that do not match any other Context's context path.

So, to sum it up: you need to have <Context path="" ... /> defined as described here.

You can find the needed details in the answer to HOWTO set the context path of a web application in Tomcat 7.0 question.

Community
  • 1
  • 1
skuntsel
  • 11,624
  • 11
  • 44
  • 67