开发者

How to create custom 404 messages in JSF 2.0?

Currently in my app when a user types some illegal destination in the URL 开发者_开发知识库bar, sees this:

How to create custom 404 messages in JSF 2.0?

I would like to make it more beautiful and customize it with my own markup and a bit of css.

-Do i need to program that on my app or i have to configure that in the application server?

-Where should i start from if i want to do that?


You can declare custom <error-page>s in web.xml depending on <error-code> (the HTTP status code) or <exception-type> (the full qualified exception class name which was been thrown, e.g. javax.faces.application.ViewExpiredException).

<error-page>
    <error-code>404</error-code>
    <location>/WEB-INF/errorpages/404.xhtml</location>
</error-page>

You've all freedom to fill in the markup in 404.xhtml.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜