0

Can someone tell me why CSS and JS stopped working in my PrimeFaces 5.1 project. I deploy my project in Apache Tomcat server.

Here is my home.xhtml page :

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

    <head></head>

    <h:body>
        <p:layout style="min-width:400px;min-height:100px;">
            <p:layoutUnit position="center" size="400"  >
            </p:layoutUnit>
        </p:layout>

        <p:layout style="min-width:400px;min-height:500px;">
            <p:layoutUnit position="west" size="244"  >
                <h5>
                    <h:form>
                        <p:menu toggleable="true">
                            <p:submenu label="Eleves">
                                <p:menuitem value="Nouvel élève"
                                            action="#{menuView.setSelectedItem(1)}"
                                            update=":globalPanel"/>

                                <p:menuitem value="Consultation"
                                            action="#{menuView.setSelectedItem(2)}"
                                            update=":globalPanel"/>

                            </p:submenu>
                            <p:submenu label="Personnels">
                            </p:submenu>
                            <p:submenu label="Notes">
                            </p:submenu>
                            <p:submenu label="Caisses">
                            </p:submenu>
                            <p:submenu label="Salaires">
                            </p:submenu>
                            <p:submenu label="Référentiel">
                            </p:submenu>
                        </p:menu>
                    </h:form>
                </h5>
            </p:layoutUnit>

            <p:layoutUnit position="center">
                <p:panel  id ="globalPanel"  >
                    <p:panel id="inscriptionPanel"
                             rendered="#{menuView.selectedItem == 1}"
                             header="Inscription"
                             style="margin-bottom:20px">
                        <ui:include src="/addStudent.xhtml" />
                    </p:panel>

                    <p:panel id="testerPanel"
                             rendered="#{menuView.selectedItem == 2}"
                             header="Consultation"
                             style="margin-bottom:20px">
                        <ui:include src="/consul.xhtml" />
                    </p:panel>
                </p:panel>
            </p:layoutUnit>
        </p:layout>
    </h:body>
</html>

When I deploy, I get errors in browser console like:

Uncaught TypeError: Cannot read property 'cw' of null (index):1

Uncaught TypeError: Cannot read property 'ab' of null (index):1

Uncaught TypeError: Cannot read property 'ab' of null (index):1

And the look'n'feel is gone:

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Adnane17
  • 119
  • 8
  • I am duplicating that same comment here. Those `cw` and `ab` are not visible in the mentioned XHTML snippet. You are the only one who can say something about them by looking into the generated HTML code. The browser will be indicating a JavaScript file having these errors with appropriate line numbers in it. Do it fast. – Tiny Jan 04 '15 at 06:53
  • Please also remember to look in server logs. – BalusC Jan 04 '15 at 10:19
  • function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {PrimeFaces.ab({s:'j_idt8:j_idt11',u:'globalPanel',f:'j_idt8'});return false; – Adnane17 Jan 04 '15 at 10:33
  • it says that primefaces has a "null" value so it can't read a property of null !! – Adnane17 Jan 04 '15 at 10:35
  • I can say that the problem is that primeFaces is not defined , it has a null value !!! – Adnane17 Jan 04 '15 at 10:45
  • I have no error in my server logs !!! – Adnane17 Jan 04 '15 at 10:53
  • Did you ever happen to click that duplicate link? The link will tell that you basically need to change the plain HTML `` to `` and you should all be fine. Those auto-generated JS/CSS files from PrimeFaces are not included in the generated HTML `` tag unless you use ``. Thus, you are running without them all. Hence, those errors. – Tiny Jan 04 '15 at 19:46
  • Thanks for the answer , but still JS not working !!! – Adnane17 Jan 05 '15 at 00:47
  • I explicitly visited your post. The system otherwise does not notify when more than one user involves unless you are explicit using a user name in conjunction with `@` like `@xxx`. Do you mean to say that the JS/CSS files from the PrimeFaces library are still not included in the generated HTML code, by the way? Try looking into the generated HTML code (on the browser of your interest - right click -> view source) to see, if required JS/CSS files (especially, `primefaces.js`) are added to the `` tag and yes do not forget to make the required change(s) in your XHTML template. – Tiny Jan 05 '15 at 09:06
  • Thanks a lot @Tiny , now my problem is with JS , css problem is fixed .I see the primefaces.js.xhtml added to the tag , yet, it dosn't work !!! – Adnane17 Jan 05 '15 at 12:43
  • If those CSS/JS are properly added to the generated HTML `` tag then, you should be receiving different errors, if any. Do you mean to say that you are still receiving the same errors as mentioned in this question and the change you made did not make any difference in anyway? It should not happen after all. In case, you are experiencing different kind of problems then, please consider asking a separate question because this question is already closed. – Tiny Jan 05 '15 at 12:49

0 Answers0