Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Exception handling JSF异常-404500代码_Exception Handling_Jsf 2_Http Status Code 404 - Fatal编程技术网

Exception handling JSF异常-404500代码

Exception handling JSF异常-404500代码,exception-handling,jsf-2,http-status-code-404,Exception Handling,Jsf 2,Http Status Code 404,我有一个JSF2应用程序,它使用PrimeFaces3.0 当我在web.xml中包含404错误代码或500错误代码时 <error-page> <error-code>404</error-code> <location>/faces/404.xhtml</location> </error-page> 如何抑制此异常?我是否缺少异常处理方面的内容 这是404.xhtml。我没有在40

我有一个JSF2应用程序,它使用PrimeFaces3.0

当我在web.xml中包含404错误代码或500错误代码时

 <error-page>
        <error-code>404</error-code>
        <location>/faces/404.xhtml</location>
 </error-page>
如何抑制此异常?我是否缺少异常处理方面的内容

这是404.xhtml。我没有在404XHTML中使用任何引用bean

    <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      id="htmlPage">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </h:head>
    <h:body id="body">
        <center>
            <div class="headerTop">
                <table id="pageHeader">
                    <tr>
                        <td align="left">
                            Header
                        </td>
                    </tr>
                </table>
            </div>
            <table id="pageContent" style="background-color: white;min-width: 60%;max-width: 90%" >
                <tr>
                    <td  align="center" valign="top" style="min-height: 600px;">
                        <table width="100%" style="float: left">
                            <tr>
                                <td>
                                    404 Error
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <table style=" width:100%;">
                <tr>
                    <td align="center">
                        <div>
                            footer
                        </div>
                    </td>
                </tr>
            </table>
        </center>
    </h:body>
</html>

标题
404错误
页脚

如果您正在访问404.xhtml中的任何支持bean,请同时发布它们的代码。我已经发布了我的404.xhtml。如果你看到的话,我没有访问任何支持bean。这里也是一样,这确实是一个bug。如果你有一个意外错误,很明显可能是任何错误,你应该重定向到一个简单的静态页面,而不是xhtml,或者jsp,但不是JSF(xhtml)页面,这样做,它就会正常工作。如果你正在访问404.xhtml中的任何支持bean,请为他们张贴代码。我已经张贴了我的404.xhtml。如果你看到的话,我不会访问任何支持bean。这里也是一样,这确实是一个bug。如果你有一个意外的错误,很明显可能是任何错误,你应该重定向到一个简单的静态页面,而不是xhtml,或者jsp,但不是JSF(xhtml)页面,这样做,它就会正常工作。
    <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      id="htmlPage">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </h:head>
    <h:body id="body">
        <center>
            <div class="headerTop">
                <table id="pageHeader">
                    <tr>
                        <td align="left">
                            Header
                        </td>
                    </tr>
                </table>
            </div>
            <table id="pageContent" style="background-color: white;min-width: 60%;max-width: 90%" >
                <tr>
                    <td  align="center" valign="top" style="min-height: 600px;">
                        <table width="100%" style="float: left">
                            <tr>
                                <td>
                                    404 Error
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <table style=" width:100%;">
                <tr>
                    <td align="center">
                        <div>
                            footer
                        </div>
                    </td>
                </tr>
            </table>
        </center>
    </h:body>
</html>