JSF:Datatable:XML解析错误,未找到任何元素

时间:2014-05-26 07:05:05

标签: jquery jsf primefaces datatable

我正在使用JSF PrimaFaces。在我的页面上,有几个动作(例如搜索项目等)。此外,项目列表显示在下方。

我使用带有分页属性的<p:datatable>创建了列表。以下是我的问题: 当我点击搜索按钮时,一切正常。 当我将页数从10更改为25时,将显示25个项目,这是预期的行为。 但是,当我在更改项目数量后单击搜索按钮时,会显示以下消息&#39; xml解析错误,未找到任何元素&#39;。

我使用了Firefox的调试工具,它显示了

  

&#39; 500内部服务器未找到错误&#39;

对此有任何帮助将不胜感激。如果需要,我会发布代码。

提前致谢。

以下是代码:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:int="http://java.sun.com/jsf/composite/intComp"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:p="http://primefaces.org/ui"
                template="./template.xhtml">

    <ui:define name="title">
        <h:outputText value="Px List"/>
    </ui:define>

    <ui:define name="help">
        This page provides list of existing items.
        <ul>
            <li>${shoppingController.appProps['RTN']}</li>
            <li>Long Name</li>
        </ul>
        The shopping item is sorted by alphabetically.              
    </ui:define>
    <ui:define name="sideMenu">
        <int:setupSideMenu FI="${shoppingController.appProps['FI']}" batchShown="${currentUser.userType eq '0'}" />
    </ui:define>
<h:outputText value="${param}"></h:outputText>
    <ui:define name="content">
        <c:choose>

            <c:when test="${not empty param.txtShoppingCode and not empty param.shoppingGroupId}">
                <c:set var="pageData" value="${shoppingController.getPxCodesOfShoppingByGroupIdAndPxName(param.shoppingGroupId, param.txtShoppingCode)}"/>
            </c:when>
            <c:when test="${not empty param.txtShoppingCode and empty param.shoppingGroupId}">
                <c:set var="pageData" value="${shoppingController.getPxCodesOfShoppingByPartnerIdAndPxName(param.cuid, param.txtShoppingCode)}"/>
            </c:when>
            <c:when test="${not empty param.shoppingGroupId}">
                <c:set var="pageData" value="${shoppingController.getPxCodesOfShoppingItemByGroupId(param.shoppingGroupId)}"/>
            </c:when>
            <c:otherwise>
                <c:set var="pageData" value="${shoppingController.getPxCodesOfShoppingByPartnerId(param.cuid)}"/>
            </c:otherwise>
        </c:choose>
 <h2 align='center'>Shopping Item List</h2>
        <table style="text-align: center; width: 100%; border: 0;">
            <tbody>
                <f:view rendered="${not empty message}">
                    <tr>
                        <td colspan="3" style="text-align: center; vertical-align: top; height: 20px;">
                            <div class="errorMessage">${message}</div>
                        </td>
                    </tr>
                </f:view>
                <tr align="right">
                    <td colspan="5" align="right">
                        <form id="frmAddCode" method="post" action="shoppingItemAdd.xhtml" >
                           <input class="ButtonStyle"
                                  type="button"
                                  id="btnAddCode"
                                  value="Add Shpopping Item"
                                  title="Add Shopping Item"
                                  style="width: 200px;"/>
                         </form>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: left; width: 25%;"></td>
                    <td style="text-align: left; width: 126px;" class="FieldLabel">${shoppingController.appProps['RTN']}</td>
                    <td style="text-align: left; width: 274px;" class="FieldLabel">Long Name</td>
                </tr>
                <tr>
                    <td style="text-align: right; width: 208px;" class="FieldLabel">${shoppingController.appProps['FI']} Details:</td>
                    <td style="text-align: left; width: 126px;">
                        <input class="DisabledField" size="10" value="${shoppingController.getPartner(param.cuid).rtn}" name="txtRtn" id="txtRtn" readonly="readonly" />
                    </td>
                    <td style="text-align: left; width: 274px;">
                        <input class="DisabledField" size="25" value="${shoppingController.getPartner(param.cuid).longname}" name="txtLongName" id="txtLongName" readonly="readonly" />
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right;" class='FieldLabel'>Select Px Code Group :</td>
                    <td style="width: 50%; text-align: left;" class="FieldLabel" colspan="2">
                        <int:shoppingGroupId formId="PxCodeGroupForm" postTo="shoppingList.xhtml" cuid="${param.cuid}"/>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right;" class='FieldLabel'>Px Code :</td>
                    <td style="text-align: left; width: 126px;"  colspan="2">
                        <form id="frmSearchByCode" method="post" action="shoppingList.xhtml">
                            <input type="hidden" name="cuid" value="${param.cuid}"/>
                            <c:if test="${not empty param.shoppingGroupId}">
                                <input type="hidden" name="shoppingGroupId" value="${param.shoppingGroupId}"/>
                            </c:if>
                            <h:inputText size="28" id="txtShoppingCode" value="${param.txtShoppingCode}"/>
                            <input  class="ButtonStyle" type="submit" name="btnSearchCode" id = "btnSearchCode"
                                    value="Search" title="Search Shppoing Item"/>
<!--                            <h:commandButton action="#{PxController.getPxCodesByPartnerId(param.cuid)}" value="Search" ></h:commandButton> -->
                        </form>
                    </td>
                </tr>

                <tr>
                    <td colspan="3">
                        <table style="width: 100%;">
                            <tr style="vertical-align: top; text-align: center;">
                                <td style="text-align: left; width: 100%;" colspan="5">
                                    <h3>List of Seacrh Items</h3>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>

                <tr>
                    <td colspan="3">
                        <h:form id="frmPxList">
                            <input type="hidden" name="cuid" value="${param.cuid}"/>
                            <c:if test="${not empty param.txtShoppingCode}">
                                <input type="hidden" name="txtShoppingCode" value="${param.txtShoppingCode}"/>
                            </c:if>
                            <c:if test="${not empty param.txtShoppingCode}">
                                <input type="hidden" name="txtShoppingCode" value="${param.txtShoppingCode}"/>
                            </c:if>
                            <p:dataTable var="shoppingItemRow" value="${pageData}"
                                    styleClass="hide-column-names" paginator="true" paginatorPosition="bottom" rows="10" rowsPerPageTemplate="10,25,50">
                                <p:column style="border-width: 0px;">
                                    <h:outputLink rendered="${not empty param.txtShoppingCode}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[0].id}" />
                                        <f:param name="txtShoppingCode" value="${param.txtShoppingCode}" />
                                        ${shoppingItemRow[0].name}
                                    </h:outputLink>
                                    <h:outputLink rendered="${empty param.shoppingGroupId}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[0].id}" />
                                        ${shoppingItemRow[0].name}
                                    </h:outputLink>
                                </p:column>
                                <p:column style="border-width: 0px;">
                                    <h:outputLink rendered="${not empty param.shoppingGroupId}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[1].id}" />
                                        <f:param name="shoppingGroupId" value="${param.shoppingGroupId}" />
                                        ${shoppingItemRow[1].name}
                                    </h:outputLink>
                                    <h:outputLink rendered="${empty param.shoppingGroupId}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[1].id}" />
                                        ${shoppingItemRow[1].name}
                                    </h:outputLink>
                                </p:column>
                                <p:column style="border-width: 0px;">
                                    <h:outputLink rendered="${not empty param.shoppingGroupId}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[2].id}" />
                                        <f:param name="shoppingGroupId" value="${param.shoppingGroupId}" />
                                        ${shoppingItemRow[2].name}
                                    </h:outputLink>
                                    <h:outputLink rendered="${empty param.shoppingGroupId}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[2].id}" />
                                        ${shoppingItemRow[2].name}
                                    </h:outputLink>
                                </p:column>
                                <p:column style="border-width: 0px;">
                                    <h:outputLink rendered="${not empty param.shoppingGroupId}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[3].id}" />
                                        <f:param name="shoppingGroupId" value="${param.shoppingGroupId}" />
                                        ${shoppingItemRow[3].name}
                                    </h:outputLink>
                                    <h:outputLink rendered="${empty param.shoppingGroupId}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[3].id}" />
                                        ${shoppingItemRow[3].name}
                                    </h:outputLink>
                                </p:column>
                                <p:column style="border-width: 0px;">
                                    <h:outputLink rendered="${not empty param.shoppingGroupId}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[4].id}" />
                                        <f:param name="shoppingGroupId" value="${param.shoppingGroupId}" />
                                        ${shoppingItemRow[4].name}
                                    </h:outputLink>
                                    <h:outputLink rendered="${empty param.shoppingGroupId}" value="${request.contextPath}/shoppingItemEdit.xhtml" styleClass="pages">
                                        <f:param name="cuid" value="${param.cuid}" />
                                        <f:param name="shoppingId" value="${shoppingItemRow[4].id}" />
                                        ${shoppingItemRow[4].name}
                                    </h:outputLink>
                                </p:column>
                            </p:dataTable>
                        </h:form>
                    </td>
                </tr>
                <ui:debug hotkey="k" rendered="true"/>
            </tbody>
        </table>

        <script type="text/javascript">
          $(document).ready(function () {
              var $frmAddCode = $('#frmAddCode');
              $frmAddCode.append('<input type="hidden" name="cuid" value="${param.cuid}" />');
              $('#btnAddCode').click(function() {
                  $frmAddCode.submit();
              });

          });


        </script>

    </ui:define>

</ui:composition>

0 个答案:

没有答案