PrimeFaces is undefined

UI Components for JSF
Post Reply
cain
Posts: 4
Joined: 04 Mar 2010, 17:21

04 Mar 2010, 17:32

Hello,

I'm trying to use the PrimeFaces Color Picker on a JSF 1.2 page that is using Facelets and RichFaces and I get a javascript "PrimeFaces is undefined" error. I added the following namespace:

xmlns:p="http://primefaces.prime.com.tr/ui

and added <p:resources/> to the <head>.

When I load the page I get the color button but when I click on it nothing happens. When I view the source it looks like the <script> and <link> tags are added properly and it looks like the propery javascript is inserted where I put the <p:colorPicker> tag when I view the source.

Any suggestions?

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

04 Mar 2010, 17:37

Can you post your PrimeFaces Resource Servlet configuration?

cain
Posts: 4
Joined: 04 Mar 2010, 17:21

04 Mar 2010, 17:43

Code: Select all

<servlet>
      <servlet-name>Resource Servlet</servlet-name>
      <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet-mapping>
      <servlet-name>Resource Servlet</servlet-name>
      <url-pattern>/primefaces_resources/*</url-pattern>
   </servlet-mapping> 
I had actually forgot to include it in my web.xml but when I put it in I still got the error.

EDIT:

Also I put the primefaces-1.0.0.jar in my WEB-INF/lib folder

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

04 Mar 2010, 17:58

Hi you got the url-pattern wrong, it should be singular.

Code: Select all

<url-pattern>/primefaces_resource/*</url-pattern>

cain
Posts: 4
Joined: 04 Mar 2010, 17:21

04 Mar 2010, 18:06

Wow as if...I thought I copied it from somewhere too. Anyway that fixed it up. Thanks.

EDIT:

The only other problem I'm having now is that when the page is first rendered the color picker is shown in expanded form then shrinks back down to just the button. The issue with that is that I have multiple color pickers displayed on the page and a reset button to set them all back to their default colours. When I click reset all of the buttons get re-rendered which causes the awkward expansion/shrink problem. Even if I can get around it on the reset, it still happens the first time the page is loaded and this is undesirable. Is there some way to work around it?

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

04 Mar 2010, 19:09

So you mean a short period of UI flicker? I think this is because of progressive enhancement approach which we can improve for sure.

cain
Posts: 4
Joined: 04 Mar 2010, 17:21

04 Mar 2010, 20:27

cagatay.civici wrote:So you mean a short period of UI flicker? I think this is because of progressive enhancement approach which we can improve for sure.
Here's a screenshot of what I am experiencing. It happens when the page is rendered. You'll notice the first color picker is fine but it starts out like the other two. After a second or two all display correctly. In total there are 16 color pickers on the page. It's possible that there may be more at some point in the future.

Image

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 55 guests