There are many possibilities but here i explain some of the basic cases.
Note: You have to set clientComponent="true" for the component to be focused.
Case 1: Default focus when a page is rendered
For this case we can set the initialFocusId for page document where pt1:it2 is the absolute id.
Case 2: Using JavaScript after Page is rendered (on some action)
var source = evt.getSource();
var it = source.findComponent("it1");
//var it = AdfPage.PAGE.findComponentByAbsoluteId("pt1:it1");
it.focus();
}
-- Java method goes here
public void TestFocus(ActionEvent actionEvent) {
// Add event code here...
FacesContext context = FacesContext.getCurrentInstance();
String textId = "pt1:it1"; //popup.getClientId(context);
StringBuilder script = new StringBuilder();
script.append("var iptext = AdfPage.PAGE.findComponent('").append(textId).append("'); ").append(" iptext.focus() ");
ExtendedRenderKitService erks =
Service.getService(context.getRenderKit(),
ExtendedRenderKitService.class);
erks.addScript(context, script.toString());
}