Search code examples
jsfprimefacesmyfacesomnifaces

Rendering problems with PrimeFaces + PrimeFaces Mobile + MyFaces ExtVal


I am trying to use together the three frameworks: PrimeFaces, PrimeFaces Mobile and MyFaces ExtVal. The library versions are: PF 3.3.1, PF Mobile 0.9.3, MyFaces ExtVal 2.0.5. Consider the following code:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui">
    <f:view>
        <h:head>
            <meta charset="UTF-8" />
            <title>Primefaces Mobile test</title>
        </h:head>
        <h:body>
            <h:form>
                <p:commandButton value="Oi" />
            </h:form>
        </h:body>
    </f:view>
</html>

If the project has only PrimeFaces and Mobile jars, the rendered commandButton is as expected:

<button id="j_idt6:j_idt7" name="j_idt6:j_idt7" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="PrimeFaces.ab({source:'j_idt6:j_idt7'});return false;" type="submit"><span class="ui-button-text">Oi</span></button>

This is the default PrimeFaces renderer. If i configure f:view with renderKitId as PRIMEFACES_MOBILE, the rendered button is:

<button id="j_idt6:j_idt7" name="j_idt6:j_idt7" type="submit" data-iconpos="left" onclick="PrimeFaces.ab({source:'j_idt6:j_idt7'});return false;">Oi</button>

It is also OK, as expected. Now, adding MyFaces ExtVal jars, everything breaks and only the PRIMEFACES_MOBILE is the renderer of the components. To test the behavior, i added the jars: myfaces-extval-bean-validation-2.0.5.jar, myfaces-extval-core-2.0.5.jar and myfaces-extval-property-validation-2.0.5.jar. Then i removed the renderKitId, so that the default PrimeFaces library should be used but again the result is:

<button id="j_idt6:j_idt7" name="j_idt6:j_idt7" type="submit" data-iconpos="left" onclick="PrimeFaces.ab({source:'j_idt6:j_idt7'});return false;">Oi</button>

I tried forcing the renderKitId in f:view to HTML_BASIC, but it keeps rendering the PrimeFaces Mobile version of the commandButton.

So guys, do you have any suggestions? Before the definition of RenderKitId, my system was OK, when i upgraded the libraries i got this error. I posted in PrimeFaces forum, but i couldn't see a way to solve, and i can't see why this is happening.


Solution

  • For those that experience the same error that i'm having, this problem is specific to the way MyFaces EXTVAL was working with the renderkit ids. Today, with the help of @Howard i saw a new fix from the EXTVAL guys which solved the problem.

    To see more information: https://issues.apache.org/jira/browse/EXTVAL-151 http://forum.primefaces.org/viewtopic.php?p=90933#p90933

    I would like to thank @Howard for the support since last year, and the MyFaces EXTVAL team for the fix. Regards.