adding two portlets on the same page with liferay and jsf 2 and primefaces causes the script in h:outputScript to not displaypla

StackOverflow https://stackoverflow.com/questions/22844312

  •  27-06-2023
  •  | 
  •  

Question

My stack is liferay 6.2, liferay faces 3.2.4 ga5, jsf 2.1.21, primefaces 3.5 When I have more than 1 portlet on a jsf page, the code in the h:outputScript section does not get sent to browser and my page is failing. Here is the code for the two pages:

            $(document).ready(function() {
                var clientId = '#{simpleFacesBean.clientId}';
                var link = "#" + clientId + "\\:simpleWidget\\:loadIQSummaryData";
                $(link).click();
            });


        </h:outputScript>
    </h:head>
    <h:body>
        <div class="wlp-bighorn-window-content">
            <h:form id="simpleWidget">

                <p:dataTable id="viewDataId" value="#{simpleFacesBean.list}" var="result"  scrollable="true" sortBy="#{result.serviceId}" sortOrder="descending">
                   <p:column headerText="Service ID" width="100" sortBy="#{result.serviceId}">
                      <h:outputText value="#{result.serviceId}"/>
                   </p:column>
                   <p:column headerText="Custom Name" width="140" sortBy="#{result.serviceAliasName}">
                        <h:outputText value="#{result.serviceAliasName}" />
                   </p:column>
                    <p:column headerText="Service Location" width="270" style="border-right:0px">
                        <h:outputText value="#{result.location}" />
                    </p:column>
                  </p:dataTable>
                  <p:blockUI block="viewDataId" trigger="loadIQSummaryData">
                      <div class="loading_widgets">
                        <p>Loading simple list..<abbr></abbr> </p>
                      </div>
                    </p:blockUI>
                  <div class="view_all_tkts">
                    <h:outputLabel id="showValue" value="#{simpleFacesBean.clientId}" escape="false"/>
                   </div>

             <p:commandLink value="click me" id="loadIQSummaryData" update="simpleWidget:viewDataId,simpleWidget:showValue" style="display:block"
                    actionListener="#{simpleFacesBean.loadData}"/>
            </h:form>
        </div>

    </h:body>
    </html>

and

    <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:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
    <h:outputScript target="head">

            $(document).ready(function() {
                var clientId = '#{simpleFacesBean2.clientId}';
                var link = "#" + clientId + "\\:simpleWidget2\\:loadIQSummaryData2";
                $(link).click();
            });


        </h:outputScript>
    </h:head>
    <h:body>
        <div class="wlp-bighorn-window-content">
            <h:form id="simpleWidget2">

                <p:dataTable id="viewDataId2" value="#{simpleFacesBean2.list}" var="result"  scrollable="true" sortBy="#{result.serviceId}" sortOrder="descending">
                   <p:column headerText="Service ID" width="100" sortBy="#{result.serviceId}">
                      <h:outputText value="#{result.serviceId}"/>
                   </p:column>
                   <p:column headerText="Custom Name" width="140" sortBy="#{result.serviceAliasName}">
                        <h:outputText value="#{result.serviceAliasName}" />
                   </p:column>
                    <p:column headerText="Service Location" width="270" style="border-right:0px">
                        <h:outputText value="#{result.location}" />
                    </p:column>
                  </p:dataTable>
                  <p:blockUI block="viewDataId2" trigger="loadIQSummaryData2">
                      <div class="loading_widgets">
                        <p>Loading simple list..<abbr></abbr> </p>
                      </div>
                    </p:blockUI>
                  <div class="view_all_tkts">
                    <h:outputLabel id="showValue2" value="#{simpleFacesBean.clientId}" escape="false"/>
                   </div>

             <p:commandLink value="click me" id="loadIQSummaryData2" update="simpleWidget2:viewDataId2,simpleWidget2:showValue2" style="display:block"
                    actionListener="#{simpleFacesBean2.loadData}"/>
            </h:form>
        </div>

    </h:body>
    </html>

Does anyone have any ideas about this?

Was it helpful?

Solution

This is a bug (FACES-1976) which has been fixed as of com.liferay.faces.util-1.0.0.jar. Updating to this release will fix the problem. See the following forum post for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top