我在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")}}});
谢谢, -Dave
答案 0 :(得分:0)
找到optimus.prime发布的帖子,这解决了它 - 答案是当你有对话框时,widgetVar应该与id不同 - 否则safari和chrome不会呈现页面。
即。坏:
<p:dialog id="tabbedJoinedD" widgetVar="tabbedJoinedD" ...
好:
<p:dialog id="tabbedJoinedD" widgetVar="tabbedJoinedDV" ...