get Submitted Value of Component in Java

public static UIComponent findComponent(UIComponent topComponent, String compId) { 
            if (compId==null) 
                    throw new NullPointerException("Component identifier cannot be null"); 

            if (compId.equals(topComponent.getId())) 
                    return topComponent; 

            if (topComponent.getChildCount()>0) { 
                    List<UIComponent> childComponents= topComponent.getChildren(); 

                    for (UIComponent currChildComponent : childComponents) { 
                            UIComponent foundComponent=findComponent(currChildComponent, compId); 
                            if (foundComponent!=null) 
                                    return foundComponent; 
            return null; 
    public static Object getSubmittedValue(String compId) {
    	UIComponent c = findComponent(FacesContext.getCurrentInstance().getViewRoot(), compId);
    	// value submitted from the browser 
    	Object o = ((UIInput) c).getSubmittedValue(); 
    	if( null == o ){ 
           // else not yet submitted
           o = ((UIInput) c).getValue();
    	return o;
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...