Search code examples
htmljakarta-eedirectorydirectory-structure

HTML folder structure


In my Dynamic Web Project, I have the following folder structure relative to the WebContent folder:

WebContent/
├── META-INF/
├── WEB-INF/
└── index.xhtml

So if I deploy my application to the server I can access it at the location: localhost:<port><context-root> which would display the index.xhtml file under the WebContent folder. I have other sections that I would like to put in their own folder. But simply for organizational reasons, it'd be nice to have all the static files, such as the XHTML files, in its own folder like:

WebContent/
├── META-INF/
├── WEB-INF/
└── Static/
    ├── Section/
    │   └── index.xhtml
    └── index.xhtml

But now if I point to localhost:<port><context-root> it won't open the index.xhtml file (because it's now located under the /Static folder). Is there a way to have localhost:<port><context-root> "point" to my Static directory without displaying it in the URL (without showing /Static)?


Solution

  • You can configure the <welcome-file-list> in your web.xml, where you can specify the file you want to visit as default page.