4

Our application JSF2/weblogic10.3.4 has different client folders deployed in root context as below.

app->webapp->ClientA->index.jsf
           ->ClientB->index.jsf

If the user request our app with client name, we need to display the corresponding index.jsf.

If the browser request is http://server/ClientA, we should display http://server/ClientA/index.jsf

If the browser request is http://server/ClientB, we should display http://server/ClientB/index.jsf

How can we achieve this?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user684434
  • 1,165
  • 2
  • 19
  • 39

1 Answers1

8

Register it as <welcome-file> in the web.xml.

<welcome-file-list>
    <welcome-file>index.jsf</welcome-file>
</welcome-file-list>

You only need to create empty files with exactly that name next to the existing index.xhtml files in the same folder, so that the container is fooled that those files really exist, otherwise you will still get 404s.

An alternative is to replace the FacesServlet URL pattern of *.jsf by *.xhtml so that you never need to fiddle with virtual URLs.

...
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555