我正在liferay 中开发primefaces portlet。我收到以下错误:
<f:ajax> contains an unknown id 'firstNameField' - cannot locate it in the context of the component firstName
代码片段是:
<aui:field id="firstNameField" label="#{i18n['first-name']}">
<p:inputText id="firstName" label="#{i18n['first-name']}" required="true"
value="#{applicantModelBean.firstName}">
<f:ajax render="firstNameField"/>
<p:message id="firstNameMessage" for="firstName"/>
</p:inputText>
</aui:field>
**Stack trace is**
javax.faces.FacesException: <f:ajax> contains an unknown id 'firstNameField' - cannot locate it in the context of the component firstName
at com.sun.faces.renderkit.html_basic.AjaxBehaviorRenderer.getResolvedId(AjaxBehaviorRenderer.java:285)
at com.sun.faces.renderkit.html_basic.AjaxBehaviorRenderer.appendIds(AjaxBehaviorRenderer.java:272)
at com.sun.faces.renderkit.html_basic.AjaxBehaviorRenderer.buildAjaxCommand(AjaxBehaviorRenderer.java:214)
at com.sun.faces.renderkit.html_basic.AjaxBehaviorRenderer.getScript(AjaxBehaviorRenderer.java:86)
at javax.faces.component.behavior.ClientBehaviorBase.getScript(ClientBehaviorBase.java:103)
at com.sun.faces.renderkit.RenderKitUtils.getSingleBehaviorHandler(RenderKitUtils.java:1607)
at com.sun.faces.renderkit.RenderKitUtils.renderHandler(RenderKitUtils.java:1700)
at com.sun.faces.renderkit.RenderKitUtils.renderOnchange(RenderKitUtils.java:388)
at com.sun.faces.renderkit.html_basic.TextRenderer.getEndTextToRender(TextRenderer.java:134)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:170)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)