0

I recently started a new project and want to use primefaces components again. I used them for an other project before but now i dont know what I am missing. My primefaces components are not rendering correctly. I cant even get a simple Spinner to work. I installed primefaces just like the last time adding the .jar to the namespace -> putting it in web-inf/lib

Here is what i tried so far: Different Glassfish (4.0/3.1) Different Primefaces Versions (4.0/3.5)

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID"
    version="3.0">
    <display-name>SocialMapS</display-name>
    <welcome-file-list>
        <welcome-file>test.xhtml</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>facesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>facesServlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
</web-app

web.xml

<?xml version="1.0" encoding="UTF-8"?>

<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
    version="2.1">
</faces-config>

faces-config.xml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  
    xmlns:h="http://java.sun.com/jsf/html"  
    xmlns:f="http://java.sun.com/jsf/core"  
    xmlns:p="http://primefaces.org/ui"> 
<head>
<title>SocialMap</title>
</head>
<h:body>
    <p:spinner />
</h:body>
</html>

login.xhtml Webpage I created to test if its working.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<title>SocialMap</title>
</head><body><span id="j_idt4" class="ui-spinner ui-widget ui-corner-all"><input id="j_idt4_input" name="j_idt4_input" type="text" class="ui-spinner-input ui-inputfield ui-state-default ui-corner-all" autocomplete="off" /><a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only"><span class="ui-button-text"><span class="ui-icon ui-icon-triangle-1-n"></span></span></a><a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only"><span class="ui-button-text"><span class="ui-icon ui-icon-triangle-1-s"></span></span></a></span><script id="j_idt4_s" type="text/javascript">PrimeFaces.cw('Spinner','widget_j_idt4',{id:'j_idt4'});</script></body>
</html>

Sourcecode in Firefox. Its just showing a textinput but not the spinner.

EDIT

WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
sourceId=null[severity=(ERROR 2), summary=(One or more resources have the target of 'head', but no 'head' component has been defined within the view.), detail=(One or more resources have the target of 'head', but no 'head' component has been defined within the view.)]

The error I get

I even tried different webbrowser. No success. I bet its a very simple mistake or I m missing something, but I didnt find it in the last 5 hours. ;-) Pls help me.

EDIT

got the problem.... was as trivial as it can get.

Should have used

<h:head>

instead of

<head>

....

-_-

Knoxz
  • 33
  • 1
  • 5

2 Answers2

3

This is a bug for the version < 3.5. If you use the version 4.0.x it will run well. If you are using eclipse, remind to do this steps to add the libraries in your WEB-INF/lib:

  1. go to Project Properties / Project Facets / Java Server Faces
  2. in type, select "User Library"
  3. click in "Manage Library" icon,
  4. than click in New,
  5. put a name, click in OK
  6. click in your recent created library
  7. click in Add external JARs
  8. select the javax.faces.jar and pramefaces-4.0jar in your User Library, "OK"
  9. Click in "Apply" next in "OK"
  10. in menu bar go to Project/Clean...

Now just run your server and have fun.

Victor Jatobá
  • 811
  • 7
  • 13
2

Simply replace <head> by <h:head> and </head> by </h:head>