Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work with differet url-pattern #18

Closed
solokingjec opened this issue Feb 22, 2018 · 3 comments
Closed

Work with differet url-pattern #18

solokingjec opened this issue Feb 22, 2018 · 3 comments

Comments

@solokingjec
Copy link

I have added this line on my web.xml

Faces Servlet
.htm

Faces Servlet
.htm

That means that my pages are loaded with the extension .htm and not .xhtml. I was trying to show 404 error but it wont show it with .xhtml properly. check this two images.
screenshot from 2018-02-22 22-47-33
screenshot from 2018-02-22 22-46-59

@rmpestano
Copy link
Contributor

rmpestano commented Feb 23, 2018

Hi,

you need to override error pages configuration on web.xml, as described here.

For your case it should be:

  <error-page>
        <error-code>403</error-code>
        <location>/403.htm</location>
    </error-page>
    <error-page>
        <exception-type>com.github.adminfaces.template.exception.AccessDeniedException</exception-type>
        <location>/403.htm</location>
    </error-page>
    <error-page>
        <error-code>404</error-code>
        <location>/404.htm</location>
    </error-page>
    <error-page>
        <error-code>500</error-code>
        <location>/500.htm</location>
    </error-page>
    <error-page>
        <exception-type>java.lang.Throwable</exception-type>
        <location>/500.htm</location>
    </error-page>
    <error-page>
        <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        <location>/expired.htm</location>
    </error-page>
    <error-page>
        <exception-type>javax.persistence.OptimisticLockException</exception-type>
        <location>/optimistic.htm</location>
    </error-page>

You'll also need to change loginPage and indexPage configuration in admin-config to respect the desired suffix, see here

I hope it helps.

@solokingjec
Copy link
Author

Do i need to add for an example 404.xhtml file in my webpages folder?

@rmpestano
Copy link
Contributor

No, only if you want to customize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants