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?
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With