"PrimeFaces not defined" error

I am trying to print using PrimeFaces printer functionality. I created a new GlassFish 3 Java EE project and added PrimeFaces 3.1.1 .jar

.

The code I'm currently using looks like this:

<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">

  <h:head>
    <title>Facelet Title</title>
  </h:head>
  <h:body>
    <h:form>
      <h:outputText id="a" value="AA" />
      <h:commandLink id="btn" value="Print">
        <p:printer target="a" />
      </h:commandLink>
    </h:form>
  </h:body>
</html>

      

Sorry, the print function does not work. Instead, the FireBug console shows me the following error:

PrimeFaces not defined

+3


source to share


7 replies


If you don't have a title, you will get this error.

The top requires the title label to work.



See # 2 for their FAQ

http://primefaces.org/faq.html

+13


source


This was a minor defect and was fixed in 3.2. final;



http://code.google.com/p/primefaces/issues/detail?id=3670

+5


source


This will also happen if you do not allow access to

$ {WebAPP} /javax.faces.resources / **

Check your XML security configuration.

JavaScript error that is undefined.

+3


source


try this ... (if it doesn't work, probably error - open ticket for issue tracker ...)

<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">  

    <h:head>  

    </h:head>  

    <h:body>  
     <h:form>
      <h:commandButton id="btn" value="Print">
        <p:printer target="output" />
      </h:commandButton>
      <h:outputText id="output" value="PrimeFaces Rocks!" />

      <h:outputLink id="lnk" value="#">
          <p:printer target="image" />
          <h:outputText value="Print Image" />
      </h:outputLink>
      <p:graphicImage id="image" value="/images/nature1.jpg" />

      </h:form>   
    </h:body>  
</html>  

      

Listen ... Persids are using the jqprint jquery plugin .... You might be better off trying to use it directly, awaiting an official clarity response ...

+2


source


You need to add the PrimeFaces namespace.

xmlns:p="http://primefaces.org/ui"  

      

Check out the PrimeFaces Getting Started Guide .

+1


source


I have the same problem if I only use p: calendar on the form. All tags in the view are jsf / facelet tags. The only tag is the calendar. It looks like the java-script is being removed as an optimization?

If I add more tags as p: dataTable the java script errors go away and the calendar component works. Perhaps this will point you where. As a workaround, you can use p: dataTable on a form with rendered = false.

+1


source


I had the same problem. I added a tag <!DOCTYPE html>

at the top of the jsf page and fixed it.

0


source







All Articles