带有错误的JSF应用程序:未定义Richfaces:Richfaces

发布于 2025-01-17 09:29:11 字数 9277 浏览 2 评论 0原文

应用程序迁移,现在打开EEN页面时存在问题,在控制台中,我看到了错误:“未定义的参考:未定义的Richfaces” 这是WebLogic服务器上的Java应用程序。 JSF是旧的,但是该应用程序对我来说是新的,我没有构建应用程序。

这是代码的一部分:

<?xml version="1.0" encoding="UTF-8"?>
<f:view
    contentType="text/html"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:win="http://winter.ba.uwv.nl/winter"
>
<html>
    <h:head>
        ...
        <script src="https://code.jquery.com/jquery-1.8.3.min.js"></script>
        <h:outputScript name="/javascript/jquery.timers.js" target="head" />
        <h:outputScript name="/javascript/preloadCssImages.jQuery_v5.js" target="head" />
        <h:outputScript name="/javascript/tooltip.js" target="head" />
        <rich:jQuery />

        <ui:remove><!-- Disable the a4j:loadStyle tags and enable the link tag to use plain setup --> </ui:remove>

        <ui:insert name="head"/>
        <h:outputScript target="head">
        
        jQuery(document).ready(function() {
            jQuery.preloadCssImages();
            ...
        });
           
        </h:outputScript>   
    </h:head>
    <h:body>
    ...

&lt; rich:jquery/&gt; 正在导致:

<span id="j_idt7" style="display: none;">
      <script type="text/javascript">RichFaces.ui.jQueryComponent.query();</script>
   </span>

和行 richfaces.ui.jquerycomponent.query(); is导致错误:

未介绍的参考:未定义的Richfaces 在家里。xhtml:13:152 (匿名) @ home.xhtml:13

我不明白为什么A&lt; span ...&gt;标签在头部添加? 在我看来,但我不确定伪影是否缺失。我试图将以下工件添加到我的pom.xml文件:

  • richfaces
  • richfaces-components-ui
  • richfaces-ui
  • richfaces-components-ui
  • richfaces-ui-core-ui

有一个人想法解决“无饮用的参考文献:richfaces not consection ernor:richfaces不是定义的“错误?

---- 更新(在Makhiel的答案之后)----

  1. 如果我们不添加富含的行:jQuery和页面正在开发,而不是启动的jQuery Spinner,但永无止境。它以此错误为“悬挂”:

undureck typeError:jquery.preloadcsssimages不是一个函数 在htmldocument。 (userList.xhtml:17:28) 在L(jQuery-1.8.3.min.js:2:16996) 在object.firewith [as asloveWith](jquery-1.8.3.3.min.js:2:17783) 在function.dready(jquery-1.8.3.3.min.js:2:12504) 在htmldocument.a(jquery-1.8.3.min.js:2:9909)

  1. 这是浏览器中的输出,在第13行中,有@makhiel提到的行。在该行之后,会产生错误的行: richfaces.ui.jquerycomponent.query();

<html>
    <head id="j_idt2">
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />                
        <script>
        /* Fix image caching problem */
            try { document.execCommand("BackgroundImageCache", false, true); } catch(err) {}
        </script>
        <title>Winter</title>
        <link rel="icon" href="/winter/favicon.ico" type="image/x-icon" />

        <script src="https://code.jquery.com/jquery-1.8.3.min.js"></script>
        <!-- This is the line of Makhiel mentioned, so it exists -->
        <script type="text/javascript" src="/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.5.17.Final/PackedCompressed/packed/packed.js"></script>

        <span id="j_idt9" style="display: none;">
            <script type="text/javascript">RichFaces.ui.jQueryComponent.query();</script>
        </span>
        ...
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/jquery.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-base-component.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/jquery.component.js">            
        <script type="text/javascript">
                jQuery(document).ready(function() {
                    jQuery.preloadCssImages();
                    //perhaps add delay
                    ...

                });
        </script>
<script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-queue.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/status.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/toolbar.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-event.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/togglePanel.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/togglePanelItem.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/collapsiblePanel.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/collapsiblePanelItem.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/message.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/jquery.position.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-utils.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-selection.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/AutocompleteBase.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/Autocomplete.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/popupPanel.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/popupPanelBorders.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/popupPanelSizer.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/component-control.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/popup.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menuKeyNavigation.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menu-base.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menu.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menugroup.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menuitem.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/contextmenu.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/tooltip.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/datatable.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/jquery.mousewheel.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/extendedDataTable.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/datascroller.js"></script>
        ...
        </head>
        <body>
        ...

An application is migrated and now there is an issue when een page is opened and in the console I see the error: "Uncaught ReferenceError: RichFaces is not defined"
It's a Java application on a Weblogic server.
JSF is old, but the application is new to me, I haven't build the application.

This is a part of the code:

<?xml version="1.0" encoding="UTF-8"?>
<f:view
    contentType="text/html"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:win="http://winter.ba.uwv.nl/winter"
>
<html>
    <h:head>
        ...
        <script src="https://code.jquery.com/jquery-1.8.3.min.js"></script>
        <h:outputScript name="/javascript/jquery.timers.js" target="head" />
        <h:outputScript name="/javascript/preloadCssImages.jQuery_v5.js" target="head" />
        <h:outputScript name="/javascript/tooltip.js" target="head" />
        <rich:jQuery />

        <ui:remove><!-- Disable the a4j:loadStyle tags and enable the link tag to use plain setup --> </ui:remove>

        <ui:insert name="head"/>
        <h:outputScript target="head">
        
        jQuery(document).ready(function() {
            jQuery.preloadCssImages();
            ...
        });
           
        </h:outputScript>   
    </h:head>
    <h:body>
    ...

The line <rich:jQuery /> is resulting in:

<span id="j_idt7" style="display: none;">
      <script type="text/javascript">RichFaces.ui.jQueryComponent.query();</script>
   </span>

And the line RichFaces.ui.jQueryComponent.query(); is resulting in the error:

Uncaught ReferenceError: RichFaces is not defined
at home.xhtml:13:152
(anonymous) @ home.xhtml:13

I don't understand why a <span...> tag is added in the head?
It seems to me, but I'm not sure an artifact is missing. I have tried to add the following artifacts to my pom.xml file:

  • richfaces
  • richfaces-components-ui
  • richfaces-ui
  • richfaces-components-ui
  • richfaces-ui-core-ui

Has someone an idea how to solve "Uncaught ReferenceError: RichFaces is not defined" error?

---- UPDATE (after the Answer of Makhiel) ----

  1. If we do not add the line rich:JQuery and the page is opnening than an jquery spinner is started, which never ends. It 'hangs' with this error:

Uncaught TypeError: jQuery.preloadCssImages is not a function
at HTMLDocument. (userList.xhtml:17:28)
at l (jquery-1.8.3.min.js:2:16996)
at Object.fireWith [as resolveWith] (jquery-1.8.3.min.js:2:17783)
at Function.ready (jquery-1.8.3.min.js:2:12504)
at HTMLDocument.A (jquery-1.8.3.min.js:2:9909)

  1. This is the output in the browser and at line 13 there is the line which is mentioned by @Makhiel. Right after that line, is the line which gives the error: RichFaces.ui.jQueryComponent.query();.

<html>
    <head id="j_idt2">
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />                
        <script>
        /* Fix image caching problem */
            try { document.execCommand("BackgroundImageCache", false, true); } catch(err) {}
        </script>
        <title>Winter</title>
        <link rel="icon" href="/winter/favicon.ico" type="image/x-icon" />

        <script src="https://code.jquery.com/jquery-1.8.3.min.js"></script>
        <!-- This is the line of Makhiel mentioned, so it exists -->
        <script type="text/javascript" src="/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.5.17.Final/PackedCompressed/packed/packed.js"></script>

        <span id="j_idt9" style="display: none;">
            <script type="text/javascript">RichFaces.ui.jQueryComponent.query();</script>
        </span>
        ...
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/jquery.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-base-component.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/jquery.component.js">            
        <script type="text/javascript">
                jQuery(document).ready(function() {
                    jQuery.preloadCssImages();
                    //perhaps add delay
                    ...

                });
        </script>
<script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-queue.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/status.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/toolbar.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-event.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/togglePanel.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/togglePanelItem.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/collapsiblePanel.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/collapsiblePanelItem.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/message.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/jquery.position.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-utils.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/richfaces-selection.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/AutocompleteBase.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/Autocomplete.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/popupPanel.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/popupPanelBorders.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/popupPanelSizer.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/component-control.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/popup.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menuKeyNavigation.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menu-base.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menu.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menugroup.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/menuitem.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/contextmenu.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/tooltip.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/datatable.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/jquery.mousewheel.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/extendedDataTable.js"></script>
        <script type="text/javascript" src="/winter/org.richfaces.resources/javax.faces.resource/org.richfaces/datascroller.js"></script>
        ...
        </head>
        <body>
        ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叫嚣ゝ 2025-01-24 09:29:11

没有任何属性的 rich:jQuery 不会执行任何操作,因此您不妨将其删除。

您不需要在 POM 中添加任何内容,如果 JSF 不知道 richfaces 标签是什么,它就不会翻译它。

您生成的 应包含 RichFaces JS 源,如下所示:

<script type="text/javascript" src="/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.5.17.Final/PackedCompressed/packed/packed.js"></script>

这是定义 RichFaces 对象的位置,如果它不在您的页面上(听起来好像不在),您可能有适当的过滤器可以阻止它。

rich:jQuery without any attributes doesn't do anything, so you might as well delete it.

You shouldn't need to add anything in your POM, if JSF didn't know what the richfaces tag was it wouldn't be translating it.

Your generated <head> should contain RichFaces JS sources, something like:

<script type="text/javascript" src="/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.5.17.Final/PackedCompressed/packed/packed.js"></script>

This is where the RichFaces object is defined, if it's not on your page (and it sounds like it isn't) you might have a filter in place that blocks it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文