JSF复合组件&LT; F:AJAX&GT;包含未知的id - 找不到它在组件的上下文中 [英] JSF Composite component <f:ajax> contains an unknown id - cannot locate it in the context of the component
问题描述
我试图用更新从复合组件事件父组件 F:AJAX
复合组件是在这里:
&LT; CC:接口&GT;
&LT; CC:属性名=更新/&GT;
&LT; CC:属性名=customid要求=真/&GT;
&LT; CC:属性名=val的要求=真/&GT;
&LT; CC:属性名=的SelectedValue要求=真/&GT;
&LT; / CC:接口&GT;
&LT; CC:实施&GT;
&LT; H:panelGrid的列=2的风格=字体大小:10px的&GT;
&LT;电话号码:selectOneMenu用于ID =#{cc.attrs.customid}值=#{cc.attrs.selectedvalue}&GT;
&LT; F:selectItems的值=#{cc.attrs.val}/&GT;
&LT; F:Ajax事件=变渲染=#{cc.attrs.update/&GT;
&LT; / P:selectOneMenu用于&GT;
&LT;电话号码:的commandButton型=按钮图标=UI图标加的onclick =dlg.show(); /&GT;
&LT; / H:panelGrid的&GT;
&LT; / CC:实施&GT;
现在使用该组件时,如下:
&LT; H:形式GT;
&LT; EZ:组合customid =使VAL =#{vehicleBean.makes}的SelectedValue =#vehicleBean.vehicle.make}更新=模式/&GT;
&LT;电话号码:selectOneMenu用于ID =模型VALUE =#{vehicleBean.vehicle.model}&GT;
&LT; F:selectItems的值=#{vehicleBean.models}/&GT;
&LT; / P:selectOneMenu用于&GT;
&LT; /小时:形式GT;
我收到以下错误:
包含未知的ID模式 - 无法找到它的成分化妆的情况下
由于更新组件就是你必须解决它以不同的方式,并抄送之外。首先给你形成一个ID:
&LT; H:格式ID =MyForm的&GT;
然后从你的CC是这样解决的目标组件
渲染=:MyForm的:模式
请注意,结尾的冒号,它可以让JSF搜索属性的文档根目录。
I'm trying to update a parent component from a composite component event using f:ajax
.
The composite component is here:
<cc:interface>
<cc:attribute name="update" />
<cc:attribute name="customid" required="true"/>
<cc:attribute name="val" required="true"/>
<cc:attribute name="selectedvalue" required="true"/>
</cc:interface>
<cc:implementation>
<h:panelGrid columns="2" style="font-size: 10px" >
<p:selectOneMenu id="#{cc.attrs.customid} value="#{cc.attrs.selectedvalue}">
<f:selectItems value="#{cc.attrs.val}"/>
<f:ajax event="change" render="#{cc.attrs.update" />
</p:selectOneMenu>
<p:commandButton type="button" icon="ui-icon-plus" onclick="dlg.show();" />
</h:panelGrid>
</cc:implementation>
Now when using this component as follows:
<h:form>
<ez:combo customid="make" val="#{vehicleBean.makes}" selectedvalue="#vehicleBean.vehicle.make}" update="model" />
<p:selectOneMenu id="model" value="#{vehicleBean.vehicle.model}">
<f:selectItems value="#{vehicleBean.models}" />
</p:selectOneMenu>
</h:form>
I get the following error:
contains an unknown id 'model' - cannot locate it in the context of the component make
Since the component to update is outside the cc you have to address it in a different way. First give your form an id:
<h:form id="myform">
Then address the target component from your cc like this:
render=":myform:model"
Notice the trailing colon which lets JSF search the attribute from the document root.
这篇关于JSF复合组件&LT; F:AJAX&GT;包含未知的id - 找不到它在组件的上下文中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!