Too many script + css imports for production use?

UI Components for JSF
alfonx
Posts: 93
Joined: 15 Mar 2010, 18:50
Contact:

01 Sep 2010, 17:34

Hi

I have an JSF2 app with many primefaces components in it. Using it (particularly on slower computers and slower Internet connections) FireFox 3.6* on Linux and Windows randomly fail to render the page, complaining about some classes not found. The error varies, e.g:
Primefaces not found
or
Primefaces.widget.dialog is not a constructor etc etc.
or
YAHOO is not defined.

Mostly the errors reference line 1, which is the line with all the primefaces JS imports in it.
I have been trying to understand this bug for the last 3 days, and my conclusion is, that the browser doesn't properly deal with the great number of .js imports. Can they be reduced to one file?

Also, the performance of the page would be much nicer, if the generated html for primefaces components would import just ONE .js file and ONE .css file.

Has anyone else seen this problem?
Wouldn't it be possible to generate one .js and one .css file server-side for each view?

Any comments welcome, as this is really a show-stopper for me + PF

Thanks in advance,
Steve
Greetings,
Steve

alfonx
Posts: 93
Joined: 15 Mar 2010, 18:50
Contact:

01 Sep 2010, 18:49

One more note: Richfaces seems to deploy all .js in one file.

And one question: I have been trying to write a patch for this, but it seems that
CoreRenderer.renderScriptDependency is not used anymore? Can you please tell me where the list of dependencies is managed and rendered?

Thanks a lot,
Steve
Greetings,
Steve

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Sep 2010, 19:28

PrimeFaces 2 is now using JSF 2's standard resource apis so we don't have any resource api anymore. Even resource servlet is obselete.

We are planning to come up with one js one css per page feature if javax.faces.PROJECT_STATE is set to production in a future release. Can you confirm RichFaces's one js workaround applies to JSF 2 or are you referencing from JSF 1.2?

alfonx
Posts: 93
Joined: 15 Mar 2010, 18:50
Contact:

01 Sep 2010, 19:32

Posting at the same time: We just found the code in UIComponent.processEvent .

>planning to come up with one js one css per page feature if javax.faces.PROJECT_STATE is set to production in a future release.
that would be a great idea. +1!!!!

But I need a patch fast, so we try to hack it dirty and see whether it helps with the rendering problems in FF.

I will see for richfaces...
Greetings,
Steve

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Sep 2010, 19:33

Can you replicate this at showcase? I've never faced with this issue with FF.

alfonx
Posts: 93
Joined: 15 Mar 2010, 18:50
Contact:

01 Sep 2010, 19:42

I have problems to reproduce it on my own computer as well (happens once every day, a reload helps), but multiple testers report that bug to me. They can reproduce it in less than a minute. I was (still am) pretty shocked, as this is evil.

I will ask them to try the showcase tomorrow. Probably the MockOS is the best page to test it on, as it uses many components.

Code: Select all

		if(!resourceExists(facesContext, "/jquery/plugins/ui/jquery.ui.dialog.css")) {
			resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
			resource.setName("/jquery/plugins/ui/jquery.ui.dialog.css");
			viewroot.addComponentResource(facesContext, resource, "head");
		}
so far, with my hacking..i thought i had understood it, but please give me a hint, why I can't find a file called "*dialog.css" in trunk?

Thanks,
Steve
Greetings,
Steve

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Sep 2010, 19:44

That is an old code in 2.1, it's gone now with 2.2.

alfonx
Posts: 93
Joined: 15 Mar 2010, 18:50
Contact:

02 Sep 2010, 09:27

Good morning.

Are you sure it's old code? I find it in package org.primefaces.component.dialog.Dialog in 2.2.M1? If it is old code, please hint me to where the dependencies of the components (e.g. a Dialog) are defined/assembled are defined. So that I can write a dirty patch and see whether it helps with the described FireFox rendering bugs.

Thanks,
Steve
Greetings,
Steve

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

02 Sep 2010, 12:18

I don't see that code in generated dialog.java. Which line?

alfonx
Posts: 93
Joined: 15 Mar 2010, 18:50
Contact:

02 Sep 2010, 13:04

Code: Select all

/primefaces/target/maven-jsf-plugin/main/java/org/primefaces/component/dialog/Dialog.java:250
I just now see that it's in maven-jsf-plugin .. whatever that means?!

Anyways, please tell me basically which lines I have to delete to make PF not generate the <script> imports. I would then provide a hand-made big.js file and see whether the bug is then gone.

PS: I was able to reproduce the bug more often on an old Windows notebook now... Still very random..

thanks for your help,
steve
Greetings,
Steve

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 56 guests