Primefaces 3.0.M3 resources problem

UI Components for JSF
iv12an
Posts: 33
Joined: 16 Nov 2010, 16:59

30 Aug 2011, 09:11

After updating to Primefaces 3.0.M3 I have this issues :
1. my css is no longer applied. My css is now applied before standard css (primefaces, jquery...), but it should be applied last.
2. my javascript library is throwing javascript error because I use "PrimeFaces.locales['hr'] = {...}" in my script and Primefaces is not defined yet.

Code: Select all

<h:head>	
	
	<link type="text/css" rel="stylesheet"
			href="resources/css/myCompany.css" />
	<script type="text/javascript" src="resources/js/myCompany.js">  			
	</script>		

</h:head>
What should I change to apply my resources?

P.S. I think this problem is related to new Primefaces head encoding (issue: 2454).

Ivan
Ivan

PrimeFaces-5.2-SNAPSHOT, PrimeFaces Extensions 3.0.0
GlassFish 4.1, Mojarra 2.2
JUEL, OmniFaces 2.0

oranheim
Posts: 64
Joined: 23 Jun 2010, 12:37
Location: Oslo, Norway
Contact:

30 Aug 2011, 09:59

Have you tried this:

Code: Select all

<h:body>   
   <h:outputScript library="js" name="myCompany.js" target="head" />
   <h:outputStylesheet library="css" name="myCompany.css" target="head" />
</h:body>
If you put this right after the h:body it'll render the resources below PF's inclusion of scripts and stylesheets.

HTH, Ove
JBoss AS 7.1
Mojarra 2.1.5
Seam 3.1.0.Final
PrimeFaces 3.1.1
PrettyFaces 3.3.2

iv12an
Posts: 33
Joined: 16 Nov 2010, 16:59

30 Aug 2011, 10:12

Yes, I tried, and it works. But, I think resources should be in h:head.

Thank you for your response.
Ivan

PrimeFaces-5.2-SNAPSHOT, PrimeFaces Extensions 3.0.0
GlassFish 4.1, Mojarra 2.2
JUEL, OmniFaces 2.0

oranheim
Posts: 64
Joined: 23 Jun 2010, 12:37
Location: Oslo, Norway
Contact:

30 Aug 2011, 10:38

I agree and this must be an anomaly in the JSF 2.x spec.

Another brittling bit is lack of control of external scripts. Further, the h:outputStylesheet and h:outputScript shouldn't be limited to local app resources. We need a way to render external scripts and non-library managed resources and off course a way to manage proper order.

I do however think that PF's fix was a correct one as it complies with W3C HTML 4.01/5.
JBoss AS 7.1
Mojarra 2.1.5
Seam 3.1.0.Final
PrimeFaces 3.1.1
PrettyFaces 3.3.2

prophet
Posts: 92
Joined: 17 Mar 2011, 19:59

30 Aug 2011, 11:31

I have the same problem, but when I add

Code: Select all

<h:body>
         <h:outputStylesheet library="css" name="main.css" target="head" />
....................
</h:body>
I catch the error in firebug

Code: Select all

"NetworkError: 404 Not Found - http://localhost:8080/HOTP/RES_NOT_FOUND"
And my main.css not load at all.
What is my problem?

oranheim
Posts: 64
Joined: 23 Jun 2010, 12:37
Location: Oslo, Norway
Contact:

30 Aug 2011, 12:09

Look at your directory structure:

/resources/css/main.css

The library is relative to resources and name relative to library.
JBoss AS 7.1
Mojarra 2.1.5
Seam 3.1.0.Final
PrimeFaces 3.1.1
PrettyFaces 3.3.2

prophet
Posts: 92
Joined: 17 Mar 2011, 19:59

30 Aug 2011, 12:19

I have the index.xhtml (this is where I include css) in the same folder as main.css and now I try

Code: Select all

<h:body>
	<h:outputStylesheet name="main.css" target="head" />
....
</h:body>

The same error. What is wrong?

JSF outputs the following HTML code:

Code: Select all

<link href="RES_NOT_FOUND" rel="stylesheet" type="text/css">

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

30 Aug 2011, 12:27

Resources which will be included with JSF must be in the resources directory in /src/main/resources/META-INF/resources/....
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko


tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

30 Aug 2011, 12:54

Why you don't use: #{request.contextPath}/.../main.css? There is no jsf tag required then
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests