clientid « Component « JSF Q&A





1. Obtaining newly generated clientId of JSF components    seamframework.org

public String getClientId(String componentId) { FacesContext context = FacesContext.getCurrentInstance(); UIViewRoot root = context.getViewRoot(); UIComponent c = findComponent(root, componentId); return c.getClientId(context); } /** * Finds component with the given id */ private UIComponent findComponent(UIComponent c, String id) { if (id.equals(c.getId())) { return c; } Iterator kids = c.getFacetsAndChildren(); while (kids.hasNext()) { UIComponent found = findComponent(kids.next(), id); if (found != null) { return ...