UICommand linkdanweimc = (UICommand) (root.findComponent("searchid").findComponent("units").findComponent("toDetail"));可以获取一个UICommand控件的值但是一个普通的控件怎么获取?
UICommand linkdanweimc = (UICommand) (root.findComponent("searchid").findComponent("units").findComponent("toDetail"));可以获取一个UICommand控件的值但是一个普通的控件怎么获取?
((LocalDataModel)dataModel).resetPage(0,50);
FacesContext facesContext = FacesContext.getCurrentInstance();
UIComponent c =facesContext.getViewRoot();
UIData data=null;
String name="frmData:userList";
c=findComponent(c,name,facesContext);
if (c!=null){
data=(UIData)c;
data.setFirst(0);
}
}
private UIComponent findComponent(UIComponent component, String id,
FacesContext context) {
String componentId = component.getClientId(context); if (componentId.equals(id)) return component;
Iterator kids = component.getChildren().iterator();
while (kids.hasNext()) {
UIComponent kid = (UIComponent) kids.next();
UIComponent found = findComponent(kid, id, context);
if (found != null) return found;
}
return null;
}
這是個找datatable的函數,看看吧