Primefaces未定义$未定义

时间:2018-10-07 11:38:30

标签: jsf primefaces jsf-2.2 uicomponents

我想开发一个带有Primefaces的JSF Page。我有一个index.xhtml,其中包含一个ui组成组件。在我的页面上,每个primefaces组件都不会加载primefaces组件和css文件。 如果我加载页面,则会出现浏览器错误:

localhost

浏览器显示以下来源:

Uncaught ReferenceError: PrimeFaces is not defined
    at developer.xhtml:1
developer.xhtml:4 Uncaught ReferenceError: PrimeFaces is not defined
    at developer.xhtml:4
developer.xhtml:4 Uncaught ReferenceError: PrimeFaces is not defined
    at developer.xhtml:4
developer.xhtml:5 Uncaught ReferenceError: PrimeFaces is not defined
    at developer.xhtml:5
developer.xhtml:5 Uncaught ReferenceError: PrimeFaces is not defined
    at developer.xhtml:5
developer.xhtml:5 Uncaught ReferenceError: PrimeFaces is not defined
    at developer.xhtml:5
developer.xhtml:9 Uncaught ReferenceError: $ is not defined
    at developer.xhtml:9

我的代码如下:

index.xhtml:

<input id="j_idt2" name="j_idt2" type="text" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /><script id="j_idt2_s" type="text/javascript">PrimeFaces.cw("InputText","widget_j_idt2",{id:"j_idt2"});</script>
        <div class="boxing">



 <div class="buttons"><button id="j_idt4" name="j_idt4" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left" onclick="PrimeFaces.ab({s:&quot;j_idt4&quot;});return false;" type="submit"><span class="ui-button-icon-left ui-icon ui-c ui-icon-star"></span><span class="ui-button-text ui-c">speichern</span></button><script id="j_idt4_s" type="text/javascript">PrimeFaces.cw("CommandButton","widget_j_idt4",{id:"j_idt4"});</script><button id="j_idt5" name="j_idt5" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left" onclick="PrimeFaces.ab({s:&quot;j_idt5&quot;});return false;" type="submit"><span class="ui-button-icon-left ui-icon ui-c ui-icon-star"></span><span class="ui-button-text ui-c">löschen</span></button><script id="j_idt5_s" type="text/javascript">PrimeFaces.cw("CommandButton","widget_j_idt5",{id:"j_idt5"});</script>
    </div><table id="j_idt7" class="ui-panelgrid ui-widget developeredit" role="grid"><tbody><tr class="ui-widget-content" role="row"><td role="gridcell" class="ui-panelgrid-cell">name</td><td role="gridcell" class="ui-panelgrid-cell"><input id="j_idt9" name="j_idt9" type="text" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all developerinput" /><script id="j_idt9_s" type="text/javascript">PrimeFaces.cw("InputText","widget_j_idt9",{id:"j_idt9"});</script></td></tr><tr class="ui-widget-content" role="row"><td role="gridcell" class="ui-panelgrid-cell">webseite</td><td role="gridcell" class="ui-panelgrid-cell"><input id="j_idt11" name="j_idt11" type="text" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all developerinput" /><script id="j_idt11_s" type="text/javascript">PrimeFaces.cw("InputText","widget_j_idt11",{id:"j_idt11"});</script></td></tr><tr class="ui-widget-content" role="row"><td role="gridcell" class="ui-panelgrid-cell">Gründungsjahr</td><td role="gridcell" class="ui-panelgrid-cell"><input id="j_idt13" name="j_idt13" type="text" value="0.0" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all developerinput" /><script id="j_idt13_s" type="text/javascript">PrimeFaces.cw("InputText","widget_j_idt13",{id:"j_idt13"});</script></td></tr></tbody></table>
</div>
<div class="boxing2"><div id="j_idt15" class="ui-datatable ui-widget ui-datatable-scrollable developerchoose"><div class="ui-datatable-header ui-widget-header ui-corner-top">
            Developer
        </div><div class="ui-widget-header ui-datatable-scrollable-header"><div class="ui-datatable-scrollable-header-box"><table role="grid"><thead id="j_idt15_head"><tr role="row"><th id="j_idt15:j_idt19" class="ui-state-default" role="columnheader" aria-label="name"><span class="ui-column-title">name</span></th></tr></thead></table></div></div><div class="ui-datatable-scrollable-body" tabindex="-1"><table role="grid"><tbody id="j_idt15_data" class="ui-datatable-data ui-widget-content" tabindex="0"><tr class="ui-widget-content ui-datatable-empty-message"><td colspan="1">No records found.</td></tr></tbody></table></div><div class="ui-widget-header ui-datatable-scrollable-footer"><div class="ui-datatable-scrollable-footer-box"><table role="grid"></table></div></div><input type="hidden" id="j_idt15_selection" name="j_idt15_selection" autocomplete="off" value="0" /><input type="hidden" id="j_idt15_scrollState" name="j_idt15_scrollState" autocomplete="off" value="0,0" /></div><script id="j_idt15_s" type="text/javascript">$(function(){PrimeFaces.cw("DataTable","widget_j_idt15",{id:"j_idt15",selectionMode:"single",scrollable:true,liveScroll:false,scrollStep:0,scrollLimit:0,liveScrollBuffer:0,behaviors:{rowUnselect:function(ext,event) {PrimeFaces.ab({s:"j_idt15",e:"rowUnselect",p:"j_idt15"},ext);},rowSelect:function(ext,event) {PrimeFaces.ab({s:"j_idt15",e:"rowSelect",p:"j_idt15"},ext);}}});});</script>


</div>

ui组成文件如下:

<?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"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">


<h:head>
    <h:outputStylesheet name="css/index.css"></h:outputStylesheet>
    <h:outputStylesheet name="css/developer.css"></h:outputStylesheet>
</h:head>


<h:body>
    <h:form id = "overview">
        <p:growl id="msgs" showDetail="true" />
        <div id="page">
            <div id="seperator">
                Launchrada
            </div>
            <div class="ordner" id="menubox">
                <p:menu id="menu" styleClass="box">
                    <p:submenu label="Ressources">
                        <p:menuitem value="Developer"></p:menuitem>
                        <p:menuitem value="Publisher"></p:menuitem>
                        <p:menuitem value="Plattform"></p:menuitem>
                        <p:menuitem value="Language"></p:menuitem>
                        <p:menuitem value="Genre"></p:menuitem>

                    </p:submenu>
                    <p:submenu label="Game">
                        <p:menuitem value="Game Creation"></p:menuitem>
                        <p:menuitem value="Game Editing"></p:menuitem>
                    </p:submenu>
                </p:menu>
                <div id="content" class="box">
                    <ui:include src = "/developer.xhtml" />
                </div>
            </div>


        </div>
    </h:form>
</h:body>
</html>

0 个答案:

没有答案