How to change index.html in every folder to / when we access it on browser

Home / Uncategorized / How to change index.html in every folder to / when we access it on browser

I’ve some unique problem, but I think this is not problem, I just want to optimize the url that my website have.

so I want to change all

on every folder as example

folder, so normally if we want access

in culture folder we can just type

right? but i want to access by just type

Is it possible to do that? If so, how we produce? I’m using jsf 2 as programming language.

Maybe I misunderstand your problem, but this can be done by configuring welcome files in the web.xml file:

Web Application developers can define an ordered list of partial URIs called welcome files in the Web application deployment descriptor. The purpose of this mechanism is to allow the deployer to specify an ordered list of partial URIs for the container to use for appending to URIs when there is a request for a URI that corresponds to a directory entry in the WAR not mapped to a Web component. This feature can make your site easier to use, because the user can type a URL without giving a specific filename.

Note: Welcome files can be JSPs, static pages, or servlets.


I’ve tested this on WildFly 11 and it works, my project structure is:+ WebContent
– index.xhtml
+ folder_a
– index.xhtml
+ folder_b
– index.html
+ folder_c
– other_name.xhtml
– some_name.html

When I enter:http://localhost:8080/myproject/ I get a content from WebContent/index.xhtml
http://localhost:8080/myproject/folder_a I get a content from WebContent/folder_a/index.xhtml
http://localhost:8080/myproject/folder_b I get a content from WebContent/folder_b/index.html

Does the .xhtml file contain JSF content? is it parsed? I always thought defining a jsf/facelets file as a welcome file did not work and you needed http redirects via ‘meta-inf’

.jsf’ is that an extension I am using in myweb.xml` file:
Faces Servlet

Please read answers for the below question to learn what it is:JSF Facelets: Sometimes I see the URL is .jsf and sometimes .xhtml. Why?
What is the difference between creating JSF pages with .jsp or .xhtml or .jsf extension
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *