"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
source to share
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 ...
source to share
You need to add the PrimeFaces namespace.
xmlns:p="http://primefaces.org/ui"
Check out the PrimeFaces Getting Started Guide .
source to share
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.
source to share