우리는 JSF 2.2 프로젝트 (코드가 명확하게하기 위해 간략화되었다)과 같이 사용되는 복합 컴포넌트에 가지고 제이보스에서F : 합성 성분 AJAX 리스너 제이보스의 작동이 중단 10
<!-- the page with the composite component inside -->
<my:component methodListener="#{myBean.myMethod}" />
<!-- the composite component -->
<cc:interface>
<cc:attribute name="methodListener" required="true" method-signature="void listener(javax.faces.event.AjaxBehaviorEvent)" />
...
<cc:implementation>
<h:commandLink>
<f:ajax listener="#{cc.attrs.methodListener}" />
<f:attribute name="myAttribute" value="myValue" />
</h:commandLink>
// the called method
public void myMethod(AjaxBehaviorEvent event)
{
System.out.println("> " + event);
}
9.0.2에서 복합 컴포넌트 내 commandLink
을 클릭하면 myMethod
이 호출되고 이벤트가 정의되어 다시 myAttribute
값을 찾을 수 있습니다.
정확히 동일한 코드의 myMethod
이 호출되지만 이벤트 매개 변수는 항상 null
입니다.
여기서 뭔가 잘못하고 있습니까?
테스트 된 해결 방법은 methodListener CC 속성을 다음 코드와 같은 bean 인스턴스로 바꿀 수 있습니다. 그래도이 작업은 프로젝트에서 많은 대체물을 필요로하므로이 솔루션을 피하고 싶습니다.
<!-- the workaround composite component -->
<cc:interface>
<cc:attribute name="methodBean" required="true" type="com.example.myBean" />
...
<cc:implementation>
<h:commandLink>
<f:ajax listener="#{cc.attrs.methodBean.myMethod}" />
<f:attribute name="myAttribute" value="myValue" />
</h:commandLink>