使用liferay和jsf 2和primefaces在同一页面上添加两个portlet会导致h:outputScript中的脚本无法显示

时间:2014-04-03 17:02:54

标签: jsf-2 primefaces liferay-6

我的筹码是 liferay 6.2,liferay faces 3.2.4 ga5,jsf 2.1.21,primefaces 3.5 当我在jsf页面上有超过1个portlet时,h:outputScript部分中的代码不会被发送到浏览器并且我的页面失败。这是两个页面的代码:                           

            $(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>

    <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>

有没有人对此有任何想法?

1 个答案:

答案 0 :(得分:2)

这是一个错误(FACES-1976),已修复为com.liferay.faces.util-1.0.0.jar。更新到此版本将解决此问题。有关详细信息,请参阅以下forum post