admin管理员组文章数量:1296401
In my project I have to display a error page when specific errors occurs in my code.
I have added the following script in my header.xhtml page.This page is added to each and every page.So whenever error occurs I want to display error page.
<script type="text/javascript">
A4J.AJAX.onExpired = function(loc, expiredMsg) {
window.location = "../facelets/error/invalidSessionLogin.jsf";
};
A4J.AJAX.onError = function(req, status, message) {
window.location = "../facelets/error/ajaxError.jsf";
};
</script>
but this is not working..
And I also configure for 500,404 error in web.xml.The code is as follows.
<context-param>
<description>Use this to suppress Facelets error page</description>
<param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
<param-value>false</param-value>
</context-param>
<error-page>
<error-code>500</error-code>
<location>/facelets/error/internalErrorHome.jsf</location>
</error-page>
<!-- if required page not available -->
<error-page>
<error-code>404</error-code>
<location>/facelets/error/pageNotFoundErrorHome.jsf</location>
</error-page>
But this gives me following error.
11:41:30,618 ERROR [[localhost]] Exception Processing ErrorPage[errorCode=404, location=/facelets/error/pageNotFoundErrorHome.jsf]
.sun.faces.context.FacesFileNotFoundException: /facelets/error/pageNotFoundErrorHome.xhtml Not Found in ExternalContext as a Resource
I don't know where I am going to wrong.. I don't get it the error Not Found in ExternalContext as a Resource
In my project I have to display a error page when specific errors occurs in my code.
I have added the following script in my header.xhtml page.This page is added to each and every page.So whenever error occurs I want to display error page.
<script type="text/javascript">
A4J.AJAX.onExpired = function(loc, expiredMsg) {
window.location = "../facelets/error/invalidSessionLogin.jsf";
};
A4J.AJAX.onError = function(req, status, message) {
window.location = "../facelets/error/ajaxError.jsf";
};
</script>
but this is not working..
And I also configure for 500,404 error in web.xml.The code is as follows.
<context-param>
<description>Use this to suppress Facelets error page</description>
<param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
<param-value>false</param-value>
</context-param>
<error-page>
<error-code>500</error-code>
<location>/facelets/error/internalErrorHome.jsf</location>
</error-page>
<!-- if required page not available -->
<error-page>
<error-code>404</error-code>
<location>/facelets/error/pageNotFoundErrorHome.jsf</location>
</error-page>
But this gives me following error.
11:41:30,618 ERROR [[localhost]] Exception Processing ErrorPage[errorCode=404, location=/facelets/error/pageNotFoundErrorHome.jsf]
.sun.faces.context.FacesFileNotFoundException: /facelets/error/pageNotFoundErrorHome.xhtml Not Found in ExternalContext as a Resource
I don't know where I am going to wrong.. I don't get it the error Not Found in ExternalContext as a Resource
Share edited Jun 13, 2013 at 6:28 vijayk asked Jun 13, 2013 at 6:19 vijaykvijayk 2,76314 gold badges43 silver badges63 bronze badges2 Answers
Reset to default 8You should test whether the path you have mentioned is reachable or not, and firstly fix the paths if they are not working.
Why don't you create a navigation case for these error codes and then instead of using relative paths, set the appropriate urls.
window.location = "${request.contextpath}/error/404";
Consider for example:
mywebapp
|
|---WEB-INF
|
|---error
| |
| |---404.xhtml
(and so on)
In web.xml:
<error-page>
<error-code>404</error-code>
<location>/error/404.xhtml</location>
</error-page>
and similarily for 500 error-code.
AFAIK you can not register a JSF page as an error-page in web.xml. Instead you have to use a JSP.
<error-page>
<error-code>404</error-code>
<location>/error404.jsp</location>
</error-page>
本文标签: javaError in configure to error page in jsfStack Overflow
版权声明:本文标题:java - Error in configure to error page in jsf? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741600800a2387689.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论