首页 > 解决方案 > 无法读取 null 的属性“cw”

问题描述

当我在我的应用程序中收到错误时,我会进入一个解释该错误的屏幕。

问题是这个屏幕上的css坏了,我不知道它会是什么。浏览器控制台上出现以下消息

Cannot read property 'cw' of null
Cannot read property of 'error' of null
Cannot read property of 'ab' of null

我正在使用 primefaces 7.0、Java 8、JSF 2.7

我的屏幕 没有css的错误屏幕

我的errorTemplate.xhtml

<!DOCTYPE html>
<ui:composition
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    xmlns:of="http://omnifaces.org/functions"
    template="/WEB-INF/errors/errorTemplate.xhtml">
    <ui:param
        name="pageName"
        value="500" />
    <ui:param
        name="modenaColor"
        value="Red" />
    <ui:define name="content">
        <i class="icon-error Fs100 Red"></i>
        <div class="Wid100 OvHidden Fs30 Red">#{contentTitle}</div>
        <div class="Wid100 OvHidden Fs15 BoldGray">#{details}</div>
        <div class="EmptyBox20"></div>
        <div class="Separator"></div>
        <div class="EmptyBox10"></div>
        <div class="Container100 Fs18 White ContainerIndent">
            <div class="ui-fluid">
                <div class="Container33 Responsive ">
                    <div class="ContainerIndent">
                        <p:button
                            value="Início"
                            icon="fa fa-home"
                            styleClass="GreenButton RaisedButton"
                            outcome="home" />
                    </div>
                </div>
                <div class="Container33 Responsive ">
                    <div class="ContainerIndent">
                        <p:button
                            value="Atualizar"
                            icon="fa fa-refresh"
                            onclick="location.reload(); return false;"
                            styleClass="OrangeButton RaisedButton" />
                    </div>
                </div>
                <div class="Container33 Responsive ">
                    <div class="ContainerIndent">
                        <p:button
                            value="Detalhes"
                            icon="fa fa-code"
                            onclick="PF('details').toggle();return false;"
                            styleClass="RedButton RaisedButton" />
                    </div>
                </div>
            </div>
        </div>
        <div class="EmptyBox20"></div>
        <p:panel
            widgetVar="details"
            style="border:none;"
            styleClass="Wid100 TexAlLeft Fs10 BoldGray"
            collapsed="true"
            toggleable="true">
            <div class="OvAuto">
                <ui:insert name="errorContent">
                    <ul>
                        <li>Data/Hora: #{of:formatDate(now, 'dd/MM/yyyy HH:mm:ss')}</li>
                        <li>User agent: #{header['user-agent']}</li>
                        <li>IP: #{empty header['x-forwarded-for'] ? request.remoteAddr : fn:split(header['x-forwarded-for'], ',')[0]}</li>
                        <li>URL: <a href="#{requestScope['javax.servlet.error.request_uri']}">#{requestScope['javax.servlet.error.request_uri']}</a></li>
                        <li>Ajax: #{facesContext.partialViewContext.ajaxRequest ? 'Sim' : 'Não'}</li>
                        <li>Código: #{requestScope['javax.servlet.error.status_code']}</li>
                        <li>Tipo: #{requestScope['javax.servlet.error.exception_type']}</li>
                        <li>Mensagem: #{requestScope['javax.servlet.error.message']}</li>
                        <li>Stack trace: <pre class="Fs10">
                        <code>#{of:printStackTrace(requestScope['javax.servlet.error.exception'])}</code>
                    </pre></li>
                    </ul>
                </ui:insert>
            </div>
        </p:panel>
    </ui:define>
</ui:composition>

最后我的 base.xhtml 我的通用 html 在哪里(它出现在所有屏幕上)

<!DOCTYPE html>
<html
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:o="http://omnifaces.org/ui"
        xmlns:p="http://primefaces.org/ui"
>
<h:outputStylesheet
        library="css"
        name="cookie.css" />
<ui:param
        name="pageName"
        value="#{empty pageName?'Gestão na nuvem':pageName}"/>
<ui:param
        name="stateless"
        value="#{empty stateless ? false : stateless}"/>
<ui:param
        name="modenaColor"
        value="${empty modenaColor ? 'Gray' : modenaColor}"/>

<f:view
        contentType="text/html"
        transient="#{stateless}"
        locale="pt">
    <h:head>
        <f:facet name="first">
            <meta
                    http-equiv="X-UA-Compatible"
                    content="IE=edge"/>
            <meta
                    http-equiv="Content-Type"
                    content="text/html; charset=UTF-8"/>
            <meta
                    name="viewport"
                    content="width=device-width,height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
            <meta
                    name="apple-mobile-web-app-capable"
                    content="yes"/>
            <meta
                    http-equiv="pragma"
                    content="no-cache"/>
            <meta
                    http-equiv="Expires"
                    content="0"/>
            <meta
                    http-equiv="cache-control"
                    content="no-cache, no-store, must-revalidate"/>
            <meta
                    name="apple-mobile-web-app-capable"
                    content="yes"/>
            <link
                    href="#{request.contextPath}/resources/images/favicon_blue.ico"
                    rel="shortcut icon"/>
        </f:facet>
        <title>e-Ceos - #{pageName}</title>
        <ui:insert name="head"/>
    </h:head>
    <h:body onload="cookieController.loadLocalStorageCookieConsent()"
            class="${modenaColor}Modena Geometry"
            style="height: auto;">

    <p:outputPanel id="center">
        <p:outputPanel id="cookie">
            <p:outputPanel id="cookieBox">
            <span id="cookieText">
                 Este site armazena cookies para melhorar sua experiência. Para maiores informações consulte a nossa
                <a
                    class="link"
                    href="https://docs.google.com/document/u/1/d/e/2PACX-1vTxtAfe-jSf0qisY6U9X2E2XOlDS2sdMOM7lx0vuMUvLu0ThIorexwU2el4nCQNTozUmUMCBDIkFbUi/pub"
                    target="_blank">política de privacidade</a>.
            </span>
            <p:button
                    id="cookieBtn"
                    value="Aceito"
                    widgetVar="cookieBtn"
                    styleClass="RaisedButton GreenButton"
                    onclick="cookieController.saveLocalStorageCookieConsent()"/>
            </p:outputPanel>
        </p:outputPanel>
    </p:outputPanel>

        <ui:insert name="body"/>
        <ui:insert name="pool">
            <h:form>
                <p:poll
                        interval="#{keepAliveController.keepAliveInterval}"
                        async="true"
                        ignoreAutoUpdate="true"
                        process="@this"
                        update="@this"
                        immediate="true"
                        listener="#{keepAliveController.keepAlive()}"/>
            </h:form>
        </ui:insert>
        <ui:fragment rendered="#{facesContext.application.projectStage ne 'Production'}">
            <ui:debug hotkey="X"/>
        </ui:fragment>

        <ui:fragment rendered="#{facesContext.application.projectStage eq 'Production'}">
            <!-- Global site tag (gtag.js) - Google Analytics -->
            <script async='async' src="https://www.googletagmanager.com/gtag/js?id=UA-64990319-3"></script>
            <script>
                  window.dataLayer = window.dataLayer || [];
                  function gtag(){dataLayer.push(arguments);}
                  gtag('js', new Date());
                
                  gtag('config', 'UA-64990319-3');


            </script>
        </ui:fragment>

        <!-- Chat do Movidesk -->
        <script type="text/javascript">var mdChatClient="#{commercialPartnerSupportController.widgetContent}";</script>
        <script src="https://chat.movidesk.com/Scripts/chat-widget.min.js"></script>
        <!-- Chat do Movidesk fim -->

        <o:deferredScript
                library="js"
                name="cookie.js" />
    </h:body>
</f:view>
</html>

注意:当我刷新屏幕时,css 会恢复。可能是 PF 7.0 中一些负载严重的 js / css 或一些已停产的属性?我试图寻找有关它的东西,但无济于事。

注意²:这似乎是一个 mojarra 错误

标签: javascriptexceptionjsfprimefaces

解决方案


推荐阅读