JSF ajax reload whole page from dropdown

10,930

Solution 1

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

If asynchronously, specify a render of @all.

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

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

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

Solution 2

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

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

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

Share:
10,930

Related videos on Youtube

4ndro1d
Author by

4ndro1d

Android Development Consumer App

Updated on June 28, 2022

Comments

  • 4ndro1d
    4ndro1d almost 2 years
    <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.

  • 4ndro1d
    4ndro1d about 11 years
    Seems both methods do not reload the whole page. Javascript isn't working then. (I'm using a slider for divs, which is destroyed when i rerender something, so I have to reload the whole page)
  • BalusC
    BalusC about 11 years
    If even the synchronous approach doesn't work, then your concrete problem is caused elsewhere. Hard to tell without having an SSCCE. Perhaps you need PRG?
  • Exorcismus
    Exorcismus about 8 years
    what if I want to to do the same plus executing a function ?