テンプレートがあります:
<html xmlns="blahblah">
<h:commandLink></h:commandLink>
<ui:insert name="body" />
</html>
このテンプレートを使用するページ:
<ui:composition xmlns="blahblah"
template="/templates/template_main.xhtml">
<ui:define name="body">
#{controller1.blahblah}
</ui:define>
</ui:composition>
このテンプレートを使用する別のページ:
<ui:composition xmlns="blahblah"
template="/templates/template_main.xhtml">
<ui:define name="body">
#{controller2.blahblah}
</ui:define>
</ui:composition>
テンプレートのコマンドリンクをクリックしたときにcontroller1
やcontroller2
が実行されるようにします。@PostConstruct
または、これが不可能な場合は、現在含まれているページの情報と、そのコントローラー Bean を呼び出してその@PostConstruct
.