Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display a default home page? [duplicate]

Tags:

jsf-2

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?

like image 223
user684434 Avatar asked Feb 21 '23 11:02

user684434


1 Answers

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>
like image 61
BalusC Avatar answered Mar 08 '23 09:03

BalusC