特別なユーザー入力ウィジェット用のカスタム jsf 2.0 コンポーネントを作成しました。
<cc:interface>
<cc:attribute name="value"></cc:attribute>
<cc:attribute name="editmode" default="true" type="java.lang.Boolean"></cc:attribute>
</cc:interface>
<cc:implementation>
....
</cc:implementation>
このコンポーネントにはいくつかの標準入力コンポーネントが含まれており、jsf 2.0 ajax の動作を利用しています。コンポーネントのすべてが正常に動作し、アプリケーションで複数回使用しています。
af:ajax 領域でコンポーネントを使用しているときに、奇妙な問題が発生しました。
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:marty="http://java.sun.com/jsf/composite/marty"
xmlns:h="http://java.sun.com/jsf/html">
<!-- Ajax region -->
<f:ajax>
<h:panelGroup id="timesheet_panel" binding="#{timesheetListComponent}">
.....
<!-- my custom component ->
<marty:userInput value="#{workitem.item['nammanager']}" editmode="true" />
....
<h:commandButton value="#{message.search}"
action="/pages/workitems/workitem"
actionListener="#{timesheetController.reset}">
<f:ajax render="timesheet_panel" onevent="updateTimesheetPanel" />
</h:commandButton>
....
</f:ajax>
</ui:composition>
奇妙なことは、コマンド ボタンがクリックされ、ajax 要求が起動されたときに、カスタム コンポーネントがフォームに 3 回表示されることです。
なぜこれが起こるのか誰でも説明できますか?