0

In the browser url bar the welcome page of my jsf app appears like:

http://www.myjsfapp.com/

I'd need to access it as:

http://www.myjsfapp.com/index.html

for the purpose of actually passing parameters:

http://www.myjsfapp.com/index.html?param=value

But http://www.myjsfapp.com/index.html gives me a 404.

What is it that I am missing?

Note: my web.xml:

<welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
seinecle
  • 10,118
  • 14
  • 61
  • 120
  • Did you configure your server to serve something useful there? (myjsfapp.com is not automatically the same as www.myjsfapp.com) – mvw Jul 15 '13 at 11:36
  • I test it in localhost at the moment. – seinecle Jul 15 '13 at 11:39
  • and I edited the question to reflect your comment – seinecle Jul 15 '13 at 11:40
  • See here for what i mean http://www.cyberciti.biz/faq/apache-redirect-domaincom-to-wwwdomaincom/ – mvw Jul 15 '13 at 11:42
  • 2
    Just map the faces servlet on `*.xhtml`. See also among others http://stackoverflow.com/questions/7885874/jsf-welcome-file-not-recognized/7889247#7889247 and http://stackoverflow.com/questions/10237416/welcome-file-in-web-xml-with-spring-not-working/10255837#10255837 – BalusC Jul 15 '13 at 11:58

1 Answers1

0

There is no index.html file in your project. Your welcome page is index.xhtml. take attention between xhtml and html.

Furthermore, if you have a servlet mapping for /faces/* in your web.xml. index.xhtml should be accessed as http://myjsfapp.com/faces/index.xhtml?param=value. It is possible to access http://myjsfapp.com/ index.xhtml?param=value, but this URL will not have JSF capabilities.

Once you add a servlet mapping like

<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>

The request which includes /faces/* patterns in the URL will be controlled by mapped servlet. It is Faces Servlet and it will be controlled by javax.faces.webapp.FacesServlet class. This servlet mapping give your requests JSF capability. Other URLs not having /faces/* will not run inside Faces Servlet meaning there is no JSF capability.

erencan
  • 3,725
  • 5
  • 32
  • 50