「ヘッダー」と「コンテンツ」で構成されるページを作成したい。common.xhtmlを作成します
<ui:insert name="header">
<ui:include src="commonHeader.xhtml" />
</ui:insert>
<ui:insert name="content">
<ui:include src="commonContent.xhtml" />
</ui:insert>
次に、2つのページ(create_user_page.xhtmlとsearch_page.xhtml)を作成します。これらのページには、同じ「ヘッダー」が必要ですが、「コンテンツ」が異なります。
<ui:composition template="common.xhtml">
<ui:define name="content">
<h1>Content for creating...</h1>
<ui:include src="create.xhtml"/>
</ui:define>
</ui:composition>
と
<ui:composition template="common.xhtml">
<ui:define name="content">
<h1>Content searching...</h1>
<ui:include src="search.xhtml"/>
</ui:define>
</ui:composition>
私のweb_flow.xmlには
<view-state id="start_page" view="administrator/main_page.xhtml">
<transition on="create_user" to="create_user_page" />
<transition on="find_user" to="search_page" />
<transition on="back" to="back" />
</view-state>
<view-state id="create_user_page" view="administrator/create_user_page.xhtml">
<transition on="create_user" to="create_user_page" />
<transition on="find_user" to="search_page" />
</view-state>
<view-state id="search_page" view="administrator/search_page.xhtml">
<transition on="create_user" to="create_user_page" />
<transition on="find_user" to="search_page" />
</view-state>
main_page.xhtmlには、ページcreate_user_page.xhtmlとsearch_page.xhtmlにつながる2つのアクション「create_user」と「find_user」(「ヘッダー」内)があります。それらは類似した「ヘッダー」を持ち、「内容」が異なります。これはすべてうまくいきますが、いくつか質問があります。
1)create_user_page.xhtmlまたはsearch_page.xhtmlにアクセスするたびに「ヘッダー」が再レンダリングされるようですが、間違っていますか?「ヘッダー」が再レンダリングされずに残り、「コンテンツ」に対してのみ変更が行われる可能性はありますか。
2)Webフローxmlで、コードを複製する必要があります
<transition on="create_user" to="create_user_page" />
<transition on="find_user" to="search_page" />
「create_user_page」および「search_page」の場合。これらのアクションは、これら2つのページで同じ「ヘッダー」で行われることを念頭に置いて、書き直す方法はありますか。