Spring web-flow and JSF templating -
Spring web-flow and JSF templating -
i want create pages consist of "header" , "content". create common.xhtml
<ui:insert name="header"> <ui:include src="commonheader.xhtml" /> </ui:insert> <ui:insert name="content"> <ui:include src="commoncontent.xhtml" /> </ui:insert>
then create 2 pages (create_user_page.xhtml , search_page.xhtml) must have same "header" different "content"
<ui:composition template="common.xhtml"> <ui:define name="content"> <h1>content creating...</h1> <ui:include src="create.xhtml"/> </ui:define> </ui:composition>
and
<ui:composition template="common.xhtml"> <ui:define name="content"> <h1>content searching...</h1> <ui:include src="search.xhtml"/> </ui:define> </ui:composition>
in web_flow.xml have
<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>
at main_page.xhtml have 2 actions "create_user" , "find_user" (in "header") lead pages create_user_page.xhtml , search_page.xhtml. have similar "header" , differ in "content". works have questions.
1) seems "header" re-rendered every time in create_user_page.xhtml or search_page.xhtml, or wrong? possible the "header" remain without re-rendering , changes made "content".
2)in web flow xml have duplicate code
<transition on="create_user" to="create_user_page" /> <transition on="find_user" to="search_page" />
for "create_user_page" , "search_page". possible how rewrite keeping in mind these actions take place in "header" same these 2 pages.
jsf templating re-render header/footer. dont think problem unless have performance-intensive in there. can avoid re-rendering by:
using html frames http://www.w3schools.com/tags/tag_frameset.asp partial rendering - either in swf flows (see tag in http://static.springsource.org/spring-webflow/docs/2.0.x/reference/htmlsingle/spring-webflow-reference.html#view-transitions), or primefaces partial renderingyou have redesign xhtml , flows if utilize either approach - partial rendering replace flow definition. like:
<h:commandlink value="go search page" actionlistener="#{mybean.gotosearchpage}" update="content"></h:commandlink> <h:commandlink value="go page" actionlistener="#{mybean.gotoanotherpage}" update="content"></h:commandlink> <h:panelgroup id="content"> <h:panelgroup id="search-page" rendered="#{mybean.isthissearchpage}"> <!-- search page contents here --> </h:panelgroup> <h:panelgroup id="another-page" rendered="#{mybean.isthisanotherpage}"> <!-- page contents here --> </h:panelgroup> </h:panelgroup>
the above approach much less maintainable , not-recommended. utilize standard swf instead , rerender header/footer whenever view changes. can still utilize partial rendering within swf view respond user's input without rerendering whole page.
regarding sec question: can utilize global transitions , flow inheritance. see how import globaltransitions.xml in myflow.xml?
jsf spring-webflow
Comments
Post a Comment