简体   繁体   English

ui是未定义的jsf primefaces

[英]ui is undefined jsf primefaces

I have a problem with using primefaces autocomplete component. 我在使用primefaces自动完成组件时遇到问题。 When triggered ia get the error $ui. 触发时我得到错误$ ui。 is undefinded and the backing bean is not even called. 是未完成的,甚至没有调用支持bean。

My code is: 我的代码是:

<p:autoComplete completeMethod="#{auto.uliList}" value="#{naroc.ulValue}"></p:autoComplete>

Big thanks for any help! 非常感谢任何帮助!

This is recognizeable as a jQuery / jQuery UI conflict. 这可以识别为jQuery / jQuery UI冲突。

PrimeFaces ships with jQuery and jQuery UI libraries by itself already. PrimeFaces本身附带了jQuery和jQuery UI库。 If you have manually included jQuery and/or jQuery UI by a custom <script> or <h:outputScript> , then it would only conflict with PrimeFaces-provided ones and result in this kind of "foo is undefined" errors. 如果您通过自定义<script><h:outputScript>手动包含jQuery和/或jQuery UI,那么它只会与PrimeFaces提供的那些冲突,并导致这种“foo未定义”错误。 You should remove your manually included jQuery scripts from the page (and your webapp) and rely on PrimeFaces-provided ones instead. 您应该从页面(和您的webapp)中删除手动包含的jQuery脚本,并依赖于PrimeFaces提供的脚本。

If you have pages which don't necessarily use PrimeFaces components (and thus its bundled jQuery scripts won't necessarily be auto-included on every page), then you need to explicitly specify PrimeFaces own jQuery instead: 如果您的页面不一定使用PrimeFaces组件(因此它的捆绑jQuery脚本不一定会自动包含在每个页面上),那么您需要显式指定PrimeFaces自己的jQuery:

<h:outputScript library="primefaces" name="jquery/jquery.js" />

I just managed to resolve my problem. 我刚刚设法解决了我的问题。 it was quite simple but effective. 这很简单但很有效。 So if you come up with a prolem similar to mine just add this code to your page head: 因此,如果您提出类似于我的问题,只需将此代码添加到您的页面头:

<h:outputScript target="head">
    jQuery.noConflict();
</h:outputScript>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM