JSF 트리에서 컴포넌트를 찾는 데 문제가 있습니다.JSF 트리의 a4j : repeat 태그에서 중첩 된 n 번째 컴포넌트 찾기
xmlns:a4j="http://richfaces.org/a4j"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.com/products/seam/taglib"
당신이 볼 수 있듯이이하는 a4j:repeat
태그가, 그래서 페이지 N 렌더링 선택 입력이있을 수 있습니다
<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>
네임 스페이스는 다음과 같이 정의된다 : 나는 다음과 같은 템플릿이 있다고 가정 . 서버 측의 JSF 트리에서 n 번째 컴포넌트를 어떻게 찾을 수 있습니까? 클라이언트 측에서 구성 요소는 someForm:somePanel:0:personPanel:personAge
과 같이 렌더링됩니다. 이 방법으로 구성 요소를 찾으려고합니다.
UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();
UIInput ageInput = (UIInput) root.findComponent("someForm:somePanel:0:personPanel:personAge");
그러나 찾을 수 없습니다. 나는 나무를 확인했는데, 그 id를 가진 구성 요소가 존재하지 않는 것 같습니다.
어떻게하면이 구성 요소를 얻을 수 있습니까? 그것을 달성 할 수있는 방법이 있습니까?
편집 :
나는 몇 가지 해결 방법을 찾았습니다. 사실, 저는 구성 요소가 필요 없지만 그들의 가치는 있습니다. 값은 요청에 따라 이름별로 검색 할 수 있습니다. 다음 코드 :
FacesContext facesContext = FacesContext.getCurrentInstance();
String ageValue = facesContext.getExternalContext().getRequestParameterMap().get("someForm:somePanel:0:personPanel:personAge");
작업을 수행했습니다.
어떤 태그 라이브러리 (XML 네임 스페이스)를 'a :'로 매핑 했습니까? – meriton
게시물을 업데이트했습니다. xmlns : a = "http://richfaces.org/a4j –