TheCoder4eu / BootsFaces-OSP

BootsFaces - Open Source Project
Apache License 2.0
246 stars 102 forks source link

PrimeFaces compatibility: b:alert causes JS errors #43

Closed stephanrauh closed 9 years ago

stephanrauh commented 9 years ago

I noticed a weird problem: <b:alert /> breaks <prime:dialog /&gt. PrimeFaces can't create the dialog widget because of an Javascript error ("undefined is not a function").

MSzturc commented 9 years ago

I noticed a similar behaviour on primefaces tooltips:

The following Example is working without any problems:

    <h:body>
        <h:form>
            <p:inputText id="xx" required="true"/>
            <h:commandButton id="submit" value="submit" />
            <p:message id="msg" for="xx" display="tooltip" />
        </h:form>
    </h:body>

    <!--<b:container/>-->

After commenting in the bootsfaces container which causes the loading of js & css files tooltips are not longer rendered.

My first assumption was that jquery which is incuded in primefaces and bootsfaces jar causes this problem. I used the Omnifaces CDNReourseHandler to map the bootsfaces jquery.js to the primefaces ones:

    <context-param>
        <param-name>org.omnifaces.CDN_RESOURCE_HANDLER_URLS</param-name>
        <param-value>bsf:jq/jquery.js=http://localhost:8080/APP/javax.faces.resource/jquery/jquery.js?ln=primefaces</param-value>
    </context-param>

After this change only one jquery.js was incuded into the page but the problem still occurs.

TheCoder4eu commented 9 years ago

What version of Primefaces? The last one?

On Thu, Jan 8, 2015 at 12:09 PM, MSzturc notifications@github.com wrote:

I noticed a similar behaviour on primefaces tooltips:

The following Example is working without any problems:

<h:body>
    <h:form>
        <p:inputText id="xx" required="true"/>
        <h:commandButton id="submit" value="submit" />
        <p:message id="msg" for="xx" display="tooltip" />
    </h:form>
</h:body>

<!--<b:container/>-->

After commenting in the bootsfaces container which causes the loading of js & css files tooltips are not longer rendered.

My first assumption was that jquery which is incuded in primefaces and bootsfaces jar causes this problem. I used the Omnifaces CDNReourseHandler to map the bootsfaces jquery.js to the primefaces ones:

<context-param>
    <param-name>org.omnifaces.CDN_RESOURCE_HANDLER_URLS</param-name>
    <param-value>bsf:jq/jquery.js=http://localhost:8080/APP/javax.faces.resource/jquery/jquery.js?ln=primefaces</param-value>
</context-param>

After this change only one jquery.js was incuded into the page but the problem still occurs.

— Reply to this email directly or view it on GitHub https://github.com/TheCoder4eu/BootsFaces-OSP/issues/43#issuecomment-69165810 .

MSzturc commented 9 years ago

Tested on: Mojarra 2.2.7 OmniFaces 2.0 PrimeFaces 5.1 GlassFish Server Open Source Edition 4.1 Bootsfaces 0.6

freddy0f commented 9 years ago

Como puedo solventar este problema.. porque tengo el mismo problema

stephanrauh commented 9 years ago

¿Tienes un projecto simple que demuestro el problema? ¿Que puedes enviarnos?

freddy0f commented 9 years ago

Estoy tratando de configurar en un proyecto bootsfaces y primefaces, pero cuando agrego el bootsfaces no se vizualizan los componentes de primefaces, me parece que el sobreescribe el jquerry de bootsfaces al de primefaces...

stephanrauh commented 9 years ago

Ah, si, ¡gracias!

Ambos frameworks tienen su propria version de jQuery 11 (11.2 en el caso de BootsFaces y 11.0 en el caso de PrimeFaces). Desafortunadamente PrimeFaces necesita mas modulos de jQueryUI que BootsFaces:

freddy0f commented 9 years ago

Y como puedo hacer para que Bottsfaces utilice el jquerry de Primefaces, al parecer eso sucede con los componentes de primerfaces esta apuntando al jquerry de bootsfaces..

stephanrauh commented 9 years ago

No sé - todavia :(. Es un bug de BootsFaces que tengo que solver - probablemente en la version 0.7.0. Pero tu cuestión es ¿como puedo hacerlo ahora?

Una idea que podria functionar or no: Añade esta linea en el h:body:

<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.min.js">
freddy0f commented 9 years ago

Estaba revizando que Bootsfaces tiene context-param no hay talvez alguno en la que pueda redefinir los recursos de bootsfaces?

stephanrauh commented 9 years ago

Queria cambiar al ingles - es mas simple para mi y los otros que lo leen.

Currently BF seems to be pretty inflexible when it comes to loading ressources - see https://github.com/TheCoder4eu/BootsFaces-OSP/blob/master/src/net/bootsfaces/render/HeadRenderer.java

Adding a context param might be a way to add flexibility. I'd prefer to autodetect PrimeFaces and user-defined ressources. currently it's an unresolved problem. Adding jQueryUI by hand should solve the problem (even if jQuery complains because of duplicate initializations). But I didn't try it yet.

CU Stephan

Am 10.02.2015 um 00:11 schrieb freddy0f notifications@github.com:

Estaba revizando que Bootsfaces tiene context-param no hay talvez alguno en la que pueda redefinir los recursos de bootsfaces?

— Reply to this email directly or view it on GitHub.

freddy0f commented 9 years ago

gracias.. me servida de mucha ayuda

stephanrauh commented 9 years ago

@freddy0f ¿De verdad? ¿Funciona mi idea?

stephanrauh commented 9 years ago

I managed to reproduce the bug on my machine and started to work on a bug fix.

stephanrauh commented 9 years ago

Done. The next version, BootsFaces 0.6.5, will be compatible to PrimeFaces.

stephanrauh commented 9 years ago

The upcoming showcase of BootsFaces 0.6.5 contains two demos of how to integrate PrimeFaces 5.1.