How to make it load the full Welcome-file url

Asked

Viewed 274 times

1

In web.xml it is mapped like this:

<welcome-file-list>
    <welcome-file>agendamento/index.xhtml</welcome-file>
</welcome-file-list>

When opening the application in the browser this opening right, but I need that url to be present because of a redirect in that index.

1 answer

2


The configuration welcome-file does not serve to make redirects.

The idea is: when a user accesses an unmapped directory of your application, the web container will search that directory for files with their respective names.

To redirect the user from the root of the application, create a filter or mapped Servlet at the root (/) that makes this redirection via code.

Or, move the file index.html to the root of your application and change the setting to:

<welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
</welcome-file-list>

Finally, redirect from there.

On the other hand, if you want to redirect the user you access /agendamento/, simply leave the file index.html in the schedule folder and use the above setting without specifying the directory.

  • 1

    Very well explained, thanks man.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.