警告:尽管 <p:message autoUpdate="true">,仍有一些未处理的 FacesMessages
WARNING: There are some unhandled FacesMessages in spite of <p:message autoUpdate="true">
大家好,我正在 eclipse 上开发 JSF+PrimeFaces 项目,我收到以下警告消息:
WARNING: There are some unhandled FacesMessages, this means not every FacesMessage had a chance to be rendered.
These unhandled FacesMessages are:
- The email field is required
- The password field is required
这里是我表单的源代码
<p:tab title="#{msg['stu']}">
<h:panelGrid columns="2" cellpadding="10">
<div class="card container">
<h:form id="formStudent">
<fieldset style="width: 300px; margin-left: 20px;">
<legend>
<h:outputText value="#{msg['page.login.student']}" />
</legend>
<div class="p-field p-grid">
<label for="email" class="p-col-fixed" style="width: 100px"><h:outputText
value="#{msg['email']}" /></label>
<div class="p-col">
<p:inputText id="emailStudent" required="true"
requiredMessage="#{msg['required.email']}"
value="#{studentMB.student.email}" type="email" />
<p:message autoUpdate="true" for="emailStudent" />
</div>
</div>
<div class="p-field p-grid">
<label for="password" class="p-col-fixed" style="width: 100px"><h:outputText
value="#{msg['password']}" /></label>
<div class="p-col">
<p:password id="passwordStudent"
requiredMessage="#{msg['required.password']}"
value="#{studentMB.student.password}" toggleMask="true"
redisplay="true" />
<p:message autoUpdate="true" for="passwordStudent" />
</div>
</div>
<p:commandButton value="#{msg['login']}"
styleClass="ui-button-raised p-mr-2 ui-button-primary"
action="#{studentMB.login}" />
<br />
</fieldset>
</h:form>
</div>
</h:panelGrid>
</p:tab>
请问我该如何解决这个问题?谢谢
应删除 p:message
上的 autoUpdate
属性,并替换为:
<p:message for="input-field-id" >
<p:autoUpdate />
</p:message>
大家好,我正在 eclipse 上开发 JSF+PrimeFaces 项目,我收到以下警告消息:
WARNING: There are some unhandled FacesMessages, this means not every FacesMessage had a chance to be rendered.
These unhandled FacesMessages are:
- The email field is required
- The password field is required
这里是我表单的源代码
<p:tab title="#{msg['stu']}">
<h:panelGrid columns="2" cellpadding="10">
<div class="card container">
<h:form id="formStudent">
<fieldset style="width: 300px; margin-left: 20px;">
<legend>
<h:outputText value="#{msg['page.login.student']}" />
</legend>
<div class="p-field p-grid">
<label for="email" class="p-col-fixed" style="width: 100px"><h:outputText
value="#{msg['email']}" /></label>
<div class="p-col">
<p:inputText id="emailStudent" required="true"
requiredMessage="#{msg['required.email']}"
value="#{studentMB.student.email}" type="email" />
<p:message autoUpdate="true" for="emailStudent" />
</div>
</div>
<div class="p-field p-grid">
<label for="password" class="p-col-fixed" style="width: 100px"><h:outputText
value="#{msg['password']}" /></label>
<div class="p-col">
<p:password id="passwordStudent"
requiredMessage="#{msg['required.password']}"
value="#{studentMB.student.password}" toggleMask="true"
redisplay="true" />
<p:message autoUpdate="true" for="passwordStudent" />
</div>
</div>
<p:commandButton value="#{msg['login']}"
styleClass="ui-button-raised p-mr-2 ui-button-primary"
action="#{studentMB.login}" />
<br />
</fieldset>
</h:form>
</div>
</h:panelGrid>
</p:tab>
请问我该如何解决这个问题?谢谢
应删除 p:message
上的 autoUpdate
属性,并替换为:
<p:message for="input-field-id" >
<p:autoUpdate />
</p:message>