0

我正在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)
4

1 回答 1

0

不知道是什么<aui:field图书馆

但是,似乎该组件没有将其传递id给生成的HTML,或者它可能会添加一些前缀......

做:查看您生成的 HTML 的源代码... 的 id 是<aui:field什么?尝试在你的f:ajax

于 2012-12-03T11:43:10.383 回答