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.
Related videos on Youtube
Comments
-
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 about 11 yearsSeems 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 about 11 yearsIf 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 about 8 yearswhat if I want to to do the same plus executing a function ?