I have a problem finding a component in a JSF tree. Suppose I have the following template:
<a4j:form id="someForm">
<a4j:outputPanel id="somePanel">
<a4j:repeat id="people" value="#{bean.people}" rowKeyVar="_row" var="_data" stateVar="_state">
<s:decorate id="personPanel" template="edit.xhtml">
<h:outputLabel for="personAge" value="Choose your age:" />
<h:selectOneMenu id="personAge" value="#{_data.age}">
<s:selectItems var="_item" value="#{ageValues}" label="#{_item.description}" />
</h:selectOneMenu>
</s:decorate>
</a4j:repeat>
</a4j:outputPanel>
</a4j:form>
Namespaces are defined as:
xmlns:a4j="http://richfaces.org/a4j"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.com/products/seam/taglib"
As you can see, there is a tag a4j:repeat, so n selected entries can be displayed on the page. How can I find the nth component in the server side JSF tree? On the client side components are displayed as follows: someForm:somePanel:0:personPanel:personAge. I am trying to find a component this way:
UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();
UIInput ageInput = (UIInput) root.findComponent("someForm:somePanel:0:personPanel:personAge");
But you can’t find him. I checked the tree, and it looks like a component with this identifier does not exist.
So how can I get this component? Is there any way to achieve this?
EDIT:
. , . . :
FacesContext facesContext = FacesContext.getCurrentInstance();
String ageValue = facesContext.getExternalContext().getRequestParameterMap().get("someForm:somePanel:0:personPanel:personAge");
.