【发布时间】:2016-03-14 07:13:42
【问题描述】:
我使用 PrimeFaces。我在客户端收到错误:SyntaxError: SyntaxError:JSON.parse:JSON 数据第 1 行第 26 列的预期双引号属性名称 http://localhost:8080/tfoms/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces&v=5.3 第 25 行
我的代码:
org_dialog_page.xhtml 页面:
<h:form id="orgDetail">
<p:tabView id="orgTabView" widgetVar="orgDetailTabView" style="height: 500px" activeIndex="#{organizationBean.activeIndex}" >
<p:tab title="General">
<p:panelGrid id="orgDetails" columns="12" styleClass="full-width ui-org-details"
columnClasses="label,value,validation_icon,label,value,validation_icon,label,value,validation_icon,label,value,validation_icon">
<h:outputText value="INN:"/>
<p:inputText id="innIndividual" widgetVar="innIndividual" style="width: 85px"
value="#{organizationBean.selectedOrganization.inn}"
rendered="#{organizationBean.selectedOrganization.regTypeName eq 'INDIVIDUAL'}"
validatorMessage="message">
<f:validateRegex pattern="^([0]{1}|[0-9]{12})$"/>
<p:clientValidator event="keyup"/>
<p:ajax event="blur" process="@this"/>
</p:inputText>
<p:message rendered="#{organizationBean.selectedOrganization.regTypeName eq 'INDIVIDUAL'}"
for="innIndividual" display="icon"/>
<p:inputText id="innLegal" widgetVar="innLegal" style="width: 85px"
value="#{organizationBean.selectedOrganization.inn}"
rendered="#{organizationBean.selectedOrganization.regTypeName ne 'INDIVIDUAL'}"
disabled="#{organizationBean.selectedOrganization.regTypeName eq 'NONE'}"
validatorMessage="message">
<f:validateRegex pattern="^[0-9]{10}$"/>
<p:clientValidator event="keyup"/>
<p:ajax event="blur" process="@this"/>
</p:inputText>
..........
</p:panelGrid>
</p:tab>
</p:tabView>
<br/>
<p:commandButton rendered="#{securityBean.canUpdate(organizationBean.dictionaryClass)}"
value="Save" actionListener="#{organizationBean.save}" action="#{organizationCacheBean.reload}"
process="@form" update="@widgetVar(orgTreeTable)"
oncomplete="autoScroll('.ui-organization-dict')"/>
org.xhtml 页面:
<p:treeTable value="#{organizationBean.rootNode}" var="organization" style="margin-top:0"
styleClass="ui-scroll-treetable-70vh ui-organization-dict" selectionMode="single"
selection="#{organizationBean.selectedNode}" widgetVar="orgTreeTable" id="orgTreeTable"
emptyMessage="message" scrollable="true" scrollHeight="500" sortBy="#{organization.shortName}">
<p:ajax event="select" listener="#{organizationBean.onOrganizationSelect}" process="@this"
update="@(.ui-organizations-toolbar)"/>
<p:column headerText="Name" style="width: 55%">
<f:facet name="header">
<h:outputText value="name"/> <br/>
<p:inputText value="#{organizationBean.shortNameFilter}" size="30"
onkeypress="if (event.keyCode == 13) { filterOrgTree(); return false; }"/>
</f:facet>
<h:outputText value="#{organization.shortName}"/>
</p:column>
....
删除更新表后出现错误:update="@widgetVar(orgTreeTable)"
知道为什么会这样吗?
【问题讨论】:
-
在 ajax 回答中我播种了错误的 JSON:
知道为什么会这样???{"validationFailed":true,}
标签: json jsf primefaces