Search code examples
jsf-2primefacesmyfaces

Using Apache Myfaces with Prime faces


I am new bie to JSF 2.0.

I am using the apache Myfaces implementation of JSF 2.0.

Also I want to use Prime faces for better UI components.

But the problem I am facing is:

The tags for both the Prime faces and Myfaces are same.

How do I resolves the prefixes.

For example: h: and f:


Solution

  • PrimeFaces does not have any tags in the http://java.sun.com/jsf/* namespace. It has only tags in the http://primefaces.org/* namespace. Tags in the http://java.sun.com/jsf/* namespace are part of the concrete JSF implementation which is in your case MyFaces. PrimeFaces is just a component library, not a JSF implementation. You are supposed to run PrimeFaces on top of a concrete JSF implementation.

    So, once having both MyFaces and PrimeFaces in the webapp's runtime classpath, this should do:

    <!DOCTYPE html>
    <html lang="en"
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"
    >
        <h:head>
            <title>Title</title>
        </h:head>
        <h:body>
            <h1>PrimeFaces editor demo</h1>
            <p:editor />
        </h:body>
    </html>