私は異なるアプリケーションで使用されるFaceletを持っています。 私はそれをコピーしないで、再利用します。いくつかのロジックは、使用されるアプリケーションによって異なる可能性があるため、ビューを管理するバッキングBeanを渡す必要があります。バッキングBeanをパラメータとしてFaceletに渡すと、
コンポジットコンポーネントは使用しませんが、 Faceletを開き、ビューを管理するBeanを指定します。どうすればこれを達成できますか?
は私が例を挙げてみましょう:
<ui:composition template="/resources/common/templates/template.xhtml"
xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich" xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<ui:define name="content">
<!-- somehow establish the backing bean that will manage formView.xhtml -->
<!-- f:set assign="ParameterBean" value="#{Bean}"/-->
<ui:include src="formView.xhtml" />
</ui:define>
</ui:composition>
formView.xhtml:
<ui:composition template="/resources/common/templates/template.xhtml"
xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich" xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<ui:define name="content">
<h:outputText value="#{ParameterBean.texto}" />
</ui:define>
</ui:composition>
どのように 'ParameterBean'は、インスタンスのメソッドを呼び出すために参照するのですか? – Thufir