Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Richfaces a4j中发送JSF参数:重复_Jsf_Parameters_Richfaces - Fatal编程技术网

在Richfaces a4j中发送JSF参数:重复

在Richfaces a4j中发送JSF参数:重复,jsf,parameters,richfaces,Jsf,Parameters,Richfaces,我正试图在a4j:repeat中放置一些下拉菜单。第二个下拉列表的值取决于第一个下拉列表中选择的值。下面是我尝试使用的代码,但它传递了一个空白参数: <a4j:repeat id="localRepeat" var="local" value="#{InstanceController.instance.locations}" rowKeyVar="row"> <h:panelGrid columns="2">

我正试图在a4j:repeat中放置一些下拉菜单。第二个下拉列表的值取决于第一个下拉列表中选择的值。下面是我尝试使用的代码,但它传递了一个空白参数:

<a4j:repeat id="localRepeat" var="local" value="#{InstanceController.instance.locations}" rowKeyVar="row">
                    <h:panelGrid columns="2">
                        <h:outputLabel value="Theater:" />
                        <h:selectOneMenu  id="theater" converter="#{TheaterConverter}" value="#{local.theater}">
                            <f:selectItems id="theaters" value="#{InstanceController.allTheaters}" />
                            <a4j:support event="onchange" action="#{InstanceController.getAllCountriesInTheater}" reRender="country" >
                                <f:param name="theater" value="#{local.theater.id}"/>
                            </a4j:support>
                        </h:selectOneMenu>

                        <h:outputLabel value="Country:" />
                        <h:selectOneMenu immediate="true" id="country" converter="#{CountryConverter}" value="#{local.country}">
                            <f:selectItems  value="#{InstanceController.allCountriesInTheater}" />
                            <a4j:support event="onchange" reRender="state" />
                        </h:selectOneMenu>

                    </h:panelGrid>
                    <rich:spacer height="10px" />
                </a4j:repeat>

如果我将f:param更改为发送“1”而不是“#{local.theater.id}”,它将按预期工作


是否有方法获取第一个下拉列表的选定值并将其作为参数发送?

这是因为当呈现f:param标记时,local.theater.id的当前值已分配给该参数。因此,theater参数将包含呈现页面时选择的剧院的id-可能为空,因为尚未选择剧院

您尝试做的事情要简单得多: 只需删除f:param并直接使用该属性。当a4j:support标记因selectbox值更改而触发时,jsf将验证表单标记并分配适当的模型值。因此,当执行GetAllCountriesInThewer操作时,local.theater属性将已经包含所选剧院

根据支持bean的设计方式,您可能需要一个参数来标识selectbox已更改的位置,因此GetAllCountriesInThewer操作将知道在哪个位置查找所选剧院