Néha a fejlesztőknek szükségük van gombok programmatikus meghívására. Ilyen tipikus példa lehet a navigáció kezelése. Például elrejthetünk egy gombot a felhasználó elől és azt automatikusan hívjuk meg.
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot root = facesContext.getViewRoot();
RichCommandButton button = (RichCommandButton) root.findComponent(“componentID″);
ActionEvent actionEvent = new ActionEvent(button);
actionEvent.queue();
IceFaces esetében javasolt a D2DViewHandler használata a komponens kikeresésére (nálam a fenti kód nem minden esetben találta meg a megadott id-val a komponenst Pl: dataTable vagy menuTab)
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot root = facesContext.getViewRoot();
RichCommandButton button = (RichCommandButton) root.findComponent(“componentID″);
ActionEvent actionEvent = new ActionEvent(button);
actionEvent.queue();
IceFaces esetében javasolt a D2DViewHandler használata a komponens kikeresésére (nálam a fenti kód nem minden esetben találta meg a megadott id-val a komponenst Pl: dataTable vagy menuTab)