From 9662ea1706d02e8634bb37997866f9bc710aa2de Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Thu, 10 Apr 2008 05:07:17 +0000 Subject: [PATCH] view history --- spring-webflow-reference/src/views.xml | 55 +++++++++++++++++++------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/spring-webflow-reference/src/views.xml b/spring-webflow-reference/src/views.xml index ac025c42..6bb7eed6 100644 --- a/spring-webflow-reference/src/views.xml +++ b/spring-webflow-reference/src/views.xml @@ -81,19 +81,8 @@ This scope is useful for manipulating objects over a series of requests from the same view, often Ajax requests. A view-state destroys its viewScope when it exits. - - Assigning a viewScope variable using an action - - Variables are often assigned before the view renders: - - -<on-render> - <evaluate expression="bookingService.findHotels(searchCriteria)" result="viewScope.hotels" result-type="dataModel" /> -</on-render> - - - - Using the var element to allocate view variables + + Allocating view variables Use the var tag to declare a view variable. Like a flow variable, any @Autowired references are automatically restored when the view state resumes. @@ -101,12 +90,23 @@ <var name="searchCriteria" class="com.mycompany.myapp.hotels.SearchCriteria" /> + + + Assigning a viewScope variable + + Use the on-render tag to assign a variable from an action result before the view renders: + + +<on-render> + <evaluate expression="bookingService.findHotels(searchCriteria)" result="viewScope.hotels" result-type="dataModel" /> +</on-render> + Manipulating objects in view scope Objects in view scope are often manipulated over a series of requests from the same view. - The following example illustrates paginiation through a search results list. + The following example pages through a search results list. The list is updated in view scope before each render. Asynchronous event handlers modify the current data page, then request re-rendering of the search results fragment. @@ -322,7 +322,7 @@ reservationConfirmation=We have processed your reservation - thank you and enjoy Use the popup attribute to render a view in a modal popup dialog: - + <view-state id="changeSearchCriteria" view="enterSearchCriteria.xhtml" popup="true"> @@ -330,4 +330,29 @@ reservationConfirmation=We have processed your reservation - thank you and enjoy Web Flow will send a response to the client requesting a redirect to the view from a popup, and the client will honor the request. + + View backtracking + + By default, when you exit a view state and transition to a new view state, you can go back to the previous state using the browser back button. + These view state history policies are configurable on a per view-state basis by using the history attribute. + + + Discarding History + + Set the history attribute to discard to prevent backtracking to a view: + + +<view-state id="changeSearchCriteria" history="discard"> + + + + Invalidating History + + Set the history attribute to invalidate to prevent backtracking to a view as well all previously displayed views: + + +<view-state id="changeSearchCriteria" history="invalidate"> + + + \ No newline at end of file