JSF ajax从下拉列表重新加载整个页面

时间:2021-08-23 20:01:35
<h:selectOneMenu id="dropdownDevice"
        value="#{skinningBean.currentDevice}" converter="SkinConverter">
        <f:selectItems value="#{skinningBean.myDevicesSI}" var="c"
            itemValue="#{c}" />
        <f:ajax event="change" render="preview" />
</h:selectOneMenu>

Is it possible to reload the whole page within this dropdown? i need this because, I also need to reload a javascript when another device was selected.

是否可以在此下拉列表中重新加载整个页面?我需要这个,因为我还需要在选择其他设备时重新加载javascript。

2 个解决方案

#1


11  

You're not clear on if you would like to perform it synchronously or asynchronously.

您不清楚是否要同步或异步执行它。

If asynchronously, specify a render of @all.

如果是异步,请指定@all的渲染。

<f:ajax ... render="@all" />

If synchronously, replace <f:ajax> by JS form.submit() call.

如果是同步的,请通过JS form.submit()调用替换

<h:selectOneMenu ... onchange="this.form.submit()">

#2


1  

You can do this simple by setting render="@all" attribute in f:ajax tag:

你可以通过在f:ajax标签中设置render =“@ all”属性来做到这一点:

<f:ajax render="@all" />

You can remove event="change" as it is default.

您可以删除event =“change”,因为它是默认值。

#1


11  

You're not clear on if you would like to perform it synchronously or asynchronously.

您不清楚是否要同步或异步执行它。

If asynchronously, specify a render of @all.

如果是异步,请指定@all的渲染。

<f:ajax ... render="@all" />

If synchronously, replace <f:ajax> by JS form.submit() call.

如果是同步的,请通过JS form.submit()调用替换

<h:selectOneMenu ... onchange="this.form.submit()">

#2


1  

You can do this simple by setting render="@all" attribute in f:ajax tag:

你可以通过在f:ajax标签中设置render =“@ all”属性来做到这一点:

<f:ajax render="@all" />

You can remove event="change" as it is default.

您可以删除event =“change”,因为它是默认值。