Reload page by clicking a radio

Hi all,
I have a radio buttons group and I want that when user selects one of them the entire page will be refreshed.
Really the target is my page to be able to switch between skins with a single click.

<bjsf:selectOneRadio layout="pageDirection" value="#{sessionData.skin}">
        <f:selectItem itemValue="chameleon" itemLabel="Chameleon" />
        <f:selectItem itemValue="system" itemLabel="System" />
</bjsf:selectOneRadio>

and in the application component:
<bjsf:application  id="main" skin="#{sessionData.skin}" clientDebug="true">
   .......
   .......
</bjsf:application>

Any suggestion?
David

reload page

Hi David,

You can use the value of radio button to change the skin of your page by reloading the whole page.

this is the workaround that I have done:
1. put the valueChangeListener = "#{sessionData.changeSkin}" in the bjsf:selectOneRadio
2. create method changeSkin in your sessionData

And below, I copied the source code for the changeSkin

public void changeSkin(ValueChangeEvent event) throws IOException {
        FacesContext context = FacesContext.getCurrentInstance();
        UIBackbaseApplication destComp = (UIBackbaseApplication)context.getViewRoot().findComponent("main");
                               
        if(event.getNewValue().toString()=="system"){
                destComp.setSkin("system");            
        }
        else{
                destComp.setSkin("chameleon");
        }
       
        DeltaActionJavaScript djs = new DeltaActionJavaScript(destComp, "location.reload(true);");
        BackbaseContext.getCurrentInstance().addDeltaAction(djs);
}

It works in my environment using JSF edition 4.1.2
Hope this helps,

Andys

OK

OK, thank you andys.
Regards