0

我在 Safari 和 Chrome 中使用 Primefaces/JSF 时出现空白屏幕。

我的代码中有以下内容 - 所以它不是被问过 1000 次的那个:

<!DOCTYPE html>
<html xmlns="http://www.w3c.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

<f:view contentType="text/html">

<h:head>
...

</p:layout>
</h:form>
</h:body>
</f:view>
</html>

此外,我的应用程序上的某些页面可以正常工作,而有些则不能。

我认为这与轮播有关,因为 chrome 在 primefaces.js 行中有一个未捕获的 TypeError

PrimeFaces.widget.Carousel=..

任何关于这是什么以及如何继续修复它的想法都非常感谢。

所有浏览器都报告错误的第 7 行是:

PrimeFaces.widget.Carousel=PrimeFaces.widget.BaseWidget.extend({init:function(b){this._super(b);this.viewport=this.jq.children(".ui-carousel-viewport");this.header=this.jq.children(".ui-carousel-header"),this.list=this.viewport.children("ul");this.items=this.list.children(".ui-carousel-item");this.prevButton=this.header.children(".ui-carousel-prev-button");this.nextButton=this.header.children(".ui-carousel-next-button");this.pageLinks=this.header.find(".ui-carousel-page-links .ui-carousel-page-link");this.dropdown=this.header.children(".ui-carousel-dropdown");this.state=$(this.jqId+"_first");this.cfg.numVisible=this.cfg.numVisible||3;this.cfg.pageLinks=this.cfg.pageLinks||3;this.cfg.effect=this.cfg.effect||"slide";this.cfg.effectDuration=this.cfg.effectDuration||500;this.cfg.easing=this.cfg.easing||"easeInOutCirc";this.cfg.pageCount=Math.ceil(this.items.length/this.cfg.numVisible);this.cfg.firstVisible=(this.cfg.firstVisible||0)%this.items.length;this.cfg.page=(this.cfg.firstVisible/this.cfg.numVisible)+1;this.animating=false;var c=this.items.filter(":first"),a=c.get(0);this.cfg.itemOuterWidth=c.innerWidth()+parseInt(this.getProperty(a,"margin-Left"))+parseInt(this.getProperty(a,"margin-Right"))+((parseInt(this.getProperty(a,"border-Left-Width"))+parseInt(this.getProperty(a,"border-Right-Width"))));this.cfg.itemOuterHeight=c.innerHeight()+Math.max(parseInt(this.getProperty(a,"margin-Top")),parseInt(this.getProperty(a,"margin-Bottom")))+((parseInt(this.getProperty(a,"border-Top-Width"))+parseInt(this.getProperty(a,"border-Bottom-Width"))));if(this.cfg.vertical){this.viewport.width(this.cfg.itemOuterWidth);this.viewport.height(this.cfg.numVisible*this.cfg.itemOuterHeight)}else{this.viewport.width(this.cfg.numVisible*this.cfg.itemOuterWidth);this.viewport.height(this.cfg.itemOuterHeight)}this.jq.width(this.viewport.outerWidth(true));this.setOffset(this.getItemPosition(this.cfg.firstVisible));this.checkButtons();this.bindEvents();if(this.cfg.autoplayInterval){this.startAutoplay()}},getProperty:function(a,b){return $.browser.msie?a.currentStyle.getAttribute(b.replace(/-/g,"")):document.defaultView.getComputedStyle(a,"").getPropertyValue(b.toLowerCase())},startAutoplay:function(){var a=this;if(this.cfg.autoPlayInterval){setInterval(function(){a.next()},this.cfg.autoPlayInterval)}},bindEvents:function(){var a=this;this.pageLinks.click(function(b){if(!a.animating){a.setPage($(this).index()+1)}b.preventDefault()});PrimeFaces.skinSelect(this.dropdown);this.dropdown.change(function(b){if(!a.animating){a.setPage(parseInt($(this).val()))}});this.prevButton.click(function(b){if(!a.prevButton.hasClass("ui-state-disabled")&&!a.animating){a.prev()}});this.nextButton.click(function(){if(!a.nextButton.hasClass("ui-state-disabled")&&!a.animating){a.next()}})},getPagePosition:function(a){return -((a-1)*(this.cfg.vertical?this.cfg.itemOuterHeight:this.cfg.itemOuterWidth)*this.cfg.numVisible)},getItemPosition:function(a){return -(a*(this.cfg.vertical?this.cfg.itemOuterHeight:this.cfg.itemOuterWidth))},getPosition:function(){return parseInt(this.list.css(this.cfg.vertical?"top":"left"))},setOffset:function(a){this.list.css(this.cfg.vertical?{top:a}:{left:a})},fade:function(b){var a=this;this.list.animate({opacity:0},{duration:this.cfg.effectDuration/2,specialEasing:{opacity:this.cfg.easing},complete:function(){a.setOffset(b);$(this).animate({opacity:1},{duration:a.cfg.effectDuration/2,specialEasing:{opacity:a.cfg.easing},complete:function(){a.animating=false}})}})},slide:function(c){var a=this,b=this.cfg.vertical?{top:c}:{left:c};this.list.animate(b,{duration:this.cfg.effectDuration,easing:this.cfg.easing,complete:function(){a.animating=false}})},next:function(){this.setPage(this.cfg.page+1)},prev:function(){this.setPage(this.cfg.page-1)},setPage:function(a){if(this.cfg.circular){this.cfg.page=a>this.cfg.pageCount?1:a<1?this.cfg.pageCount:a}else{this.cfg.page=a}this.checkButtons();this.state.val((this.cfg.page-1)*this.cfg.numVisible);var b=this.getPagePosition(this.cfg.page);if(this.getPosition()==b){this.animating=false;return}if(this.cfg.effect=="fade"){this.fade(b)}else{this.slide(b)}},checkButtons:function(){this.pageLinks.filter(".ui-icon-radio-on").removeClass("ui-icon-radio-on");this.pageLinks.eq(this.cfg.page-1).addClass("ui-icon-radio-on");this.dropdown.val(this.cfg.page);if(this.cfg.circular){return}if(this.cfg.page==1){this.prevButton.addClass("ui-state-disabled")}else{this.prevButton.removeClass("ui-state-disabled")}if(this.cfg.page>=this.cfg.pageCount){this.nextButton.addClass("ui-state-disabled")}else{this.nextButton.removeClass("ui-state-disabled")}}});

谢谢,-戴夫

4

1 回答 1

0

找到了 optimus.prime 的帖子并解决了它 - 答案是当你有对话框时,widgetVar 应该不同于 id - 否则 safari 和 chrome 不会呈现页面。

即坏:

<p:dialog id="tabbedJoinedD" widgetVar="tabbedJoinedD" ...

好的:

<p:dialog id="tabbedJoinedD" widgetVar="tabbedJoinedDV" ...
于 2013-09-04T19:52:38.197 回答