Kombinált nézet Egyszerű nézet Fa-nézet
Szálak [ Előző | Következő ]
toggle
J S
Duplication of resource includes with multiple portlets
2012. június 6. 5:38
Válasz

J S

Rangsorolás: Junior Member

Hozzászólások: 31

Csatlakozás dátuma: 2012. április 11.

Legújabb hozzászólások

Hi,

We've suffered from the problem whereby if 2 portlets include the same resource (javascript etc.) then it gets included twice. I saw this issue reported on the Primefaces forum, and described in their bug database, along with a possible solution:

http://code.google.com/p/primefaces/issues/detail?id=2436#c6 I've not found a comparable issue in the faces jira database.

I've implemented the solution proposed and it seems to work well for us.

Would the liferay-faces project be interested in receiving the patch?

Thanks,

John
Neil Griffin
RE: Duplication of resource includes with multiple portlets
2012. június 6. 6:59
Válasz

Neil Griffin

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1455

Csatlakozás dátuma: 2005. július 26.

Legújabb hozzászólások

The issue in the Liferay Issue Tracker is FACES-1216 which has a corresponding issue 4093 in the PrimeFaces issue tracker that Çağatay and I have discussed verbally.

Is the problem you're having strictly a JavaScript conflict, or are you referring to a slowdown of page load times due to redundant copies of resources being downloaded?
J S
RE: Duplication of resource includes with multiple portlets
2012. június 6. 7:02
Válasz

J S

Rangsorolás: Junior Member

Hozzászólások: 31

Csatlakozás dátuma: 2012. április 11.

Legújabb hozzászólások

Yes, it was a while ago that I did this but I think I had issues because things like jQuery were being loaded twice. I couldn't just place the jquery.js in the standard header because it was being referred to by JSF component annotations.

Was this going to be on the roadmap for the 3.1 release?

John
Neil Griffin
RE: Duplication of resource includes with multiple portlets
2012. június 6. 7:18
Válasz

Neil Griffin

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1455

Csatlakozás dátuma: 2005. július 26.

Legújabb hozzászólások

PrimeFaces 3.1 was released last week, but the release announcement indicates that PrimeFaces 3.3.1 is coming next with some patches that I have provided. The duplicate prime.js issue is on Çağatay's radar screen for 3.3.1, but we will have to wait and see if the fix makes it in 3.3.1.

Note that Çağatay is only focussed on the problem with duplicate prime.js resources -- not duplicate jquery.js resources. At one time I thought that JQuery was able to handle multiple copies/versions of itself on the same page. But I don't know if that's still the case.
J S
RE: Duplication of resource includes with multiple portlets
2012. június 7. 6:44
Válasz

J S

Rangsorolás: Junior Member

Hozzászólások: 31

Csatlakozás dátuma: 2012. április 11.

Legújabb hozzászólások

I've just looked at this again and my problem is caused by the duplicate javascript includes.

I have 2 portlets, they both include jQuery.js .

One portlet also includes a jquery plugin called jQuery.js

I then get this error:

1TypeError: jQuery("#mcarousel").jcarousel is not a function


I think what is happening is that the plugin is being applied to one jQuery object, but not the other. If I remove the portlet that doesn't use the carousel plugin then the carousel starts working.

I am using an older version of Primefaces, but I don't think that is really the issue. The carousel javascript is included via a ResourceDependency in a Component I've written, it just so happens that jquery is being included by Primefaces,. If I wasn't using primefaces and including jQuery via a ResourceDependency then this same error would occur if I used my component in 2 different portlets.

So going forward should this be handled by the bridge? My patch seems to work but I need to try it again with the latest release.

John
Hitoshi Ozawa
RE: Duplication of resource includes with multiple portlets
2012. június 7. 6:47
Válasz

Hitoshi Ozawa

Rangsorolás: Liferay Legend

Hozzászólások: 8000

Csatlakozás dátuma: 2010. március 23.

Legújabb hozzászólások

Had the same problem. I just moved my jquery to portal_normal.vm
Neil Griffin
RE: Duplication of resource includes with multiple portlets
2012. június 7. 9:02
Válasz

Neil Griffin

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1455

Csatlakozás dátuma: 2005. július 26.

Legújabb hozzászólások

@John: Hitoshi's workaround is good, but I'd be happy to review your patch. If you upload it to the forums as an attachment here, please be aware that you will be required to abide by a contributor agreement.
J S
RE: Duplication of resource includes with multiple portlets
2012. június 7. 9:56
Válasz

J S

Rangsorolás: Junior Member

Hozzászólások: 31

Csatlakozás dátuma: 2012. április 11.

Legújabb hozzászólások

Where can I see the contributor agreement? I'm perfectly happy to abide by it but I need to check that my employer is too.

Thanks,

John
Neil Griffin
RE: Duplication of resource includes with multiple portlets
2012. június 7. 10:30
Válasz

Neil Griffin

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1455

Csatlakozás dátuma: 2005. július 26.

Legújabb hozzászólások

Neil Griffin
RE: Duplication of resource includes with multiple portlets
2012. június 8. 7:43
Válasz

Neil Griffin

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1455

Csatlakozás dátuma: 2005. július 26.

Legújabb hozzászólások

Hi John,

It would be great if you could attach your patch to FACES-1216. You should see a "Contribute Solution" button that will provide you with an "I Agree" button with a link to the Contributor Agreement.

Thanks again,

Neil
J S
RE: Duplication of resource includes with multiple portlets
2012. június 8. 7:44
Válasz

J S

Rangsorolás: Junior Member

Hozzászólások: 31

Csatlakozás dátuma: 2012. április 11.

Legújabb hozzászólások

I will do, but I wanted to pass the contributor agreement past my employers, and time zone differences mean it probably won't be till after the weekend.

Thanks,

John
Neil Griffin
RE: Duplication of resource includes with multiple portlets
2012. június 8. 7:52
Válasz

Neil Griffin

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1455

Csatlakozás dátuma: 2005. július 26.

Legújabb hozzászólások

OK thanks. emoticon
J S
RE: Duplication of resource includes with multiple portlets
2012. július 16. 1:24
Válasz

J S

Rangsorolás: Junior Member

Hozzászólások: 31

Csatlakozás dátuma: 2012. április 11.

Legújabb hozzászólások

It looks like I can't submit my patch.

However all I did was implement what the issue http://code.google.com/p/primefaces/issues/detail?id=2436#c6 said to do, so I don't think my patch actually would offer any great insight.

Since originally coming across this issue I've also found another problem related to it. If you have several JSF Portlets on the page, all using components that use ResourceDependency annotaions to bring in CSS files then the number of CSS resources on the page can quickly mount up. One page I had had > 80.

IE only supports 32 CSS includes, anything above this is ignored. This basically broke the page in all version of IE.

If each CSS was only included once then this would obviously be less likely to occur.

Is it possibly that this could be looked at again for 3.1 final?

John
Neil Griffin
RE: Duplication of resource includes with multiple portlets
2012. szeptember 4. 12:32
Válasz

Neil Griffin

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1455

Csatlakozás dátuma: 2005. július 26.

Legújabb hozzászólások

I just committed a Liferay vendor-specific fix for FACES-1216. Please give it a try as soon as you can. You can download 3.1.0-ga1-SNAPSHOT artifacts from the snapshot repository.
J S
RE: Duplication of resource includes with multiple portlets
2012. július 18. 8:09
Válasz

J S

Rangsorolás: Junior Member

Hozzászólások: 31

Csatlakozás dátuma: 2012. április 11.

Legújabb hozzászólások

It looks like this has fixed the problem. Thanks!

John
Neil Griffin
RE: Duplication of resource includes with multiple portlets
2012. július 18. 8:20
Válasz

Neil Griffin

LIFERAY STAFF

Rangsorolás: Liferay Legend

Hozzászólások: 1455

Csatlakozás dátuma: 2005. július 26.

Legújabb hozzászólások

Thanks for kicking the tires John. I'm glad it worked for you. It would be great to hear from others too, in order to make sure that the fix is working for everyone.