Spring WebFlow - business logic in view-state or action-state
What is the best place to call the business logic in? I have the  following requirements.

1). Get the search criteria from user

2). If the current user is trying search for unauthorized results throw business exception

3). Retrieve results 

4). If number of results==0, go to search page again and put a message.

5). If number of results>limit, go to search page again and put a message.

6). Go to showresults page.

This is what I have so far...

    <flow....>
          <on-start>
              <evaluate expression="appConfig.setUpSupportData()" result="flowScope.supportData"/>	
          </on-start>
          <view-state id="searchHome" view="searchHome" model="searchCriteria">
               <transition on="search" to="doSearch"/>
          </view-state> 
            
          <action-state id="doSearch">
                 <evaluate expression="searchUtil.getSearchResults(flowScope.searchCriteria)" result="flowScope.personList"/>
                 <evaluate expression="searchUtil.showSearchResults(flowScope.personList, flowRequestContext)" >
                         <attribute name="name" value="expression2"/>
                 </evaluate>
                 <transition on="expression2.yes" to="showSearchResults"/>
                 <transition on="expression2.no" to="searchHome"/>
         </action-state>
         <view-state id="showSearchResults"></view-state>
    </flow>


My question is, should I be calling the getSearchResults() method in action-stae or in view-state="showSearchResults"? If I call the method in action-stae, I have to put the search results in flowscope so that second view can get the results - I am worried about memory in this scenario. If I call the method in second view- on-entry, I can put the personList in viewscope but how do I handle cases 2,4 and 5?

Thanks in advance!
            
Spring WebFlow - business logic in view-state or action-state
===

What is the best place to call the business logic in? I have the  following requirements.

1). Get the search criteria from user

2). If the current user is trying search for unauthorized results throw business exception

3). Retrieve results 

4). If number of results==0, go to search page again and put a message.

5). If number of results>limit, go to search page again and put a message.

6). Go to showresults page.

This is what I have so far...

    <flow....>
          <on-start>
              <evaluate expression="appConfig.setUpSupportData()" result="flowScope.supportData"/>	
          </on-start>
          <view-state id="searchHome" view="searchHome" model="searchCriteria">
               <transition on="search" to="doSearch"/>
          </view-state> 
            
          <action-state id="doSearch">
                 <evaluate expression="searchUtil.getSearchResults(flowScope.searchCriteria)" result="flowScope.personList"/>
                 <evaluate expression="searchUtil.showSearchResults(flowScope.personList, flowRequestContext)" >
                         <attribute name="name" value="expression2"/>
                 </evaluate>
                 <transition on="expression2.yes" to="showSearchResults"/>
                 <transition on="expression2.no" to="searchHome"/>
         </action-state>
         <view-state id="showSearchResults"></view-state>
    </flow>


My question is, should I be calling the getSearchResults() method in action-stae or in view-state="showSearchResults"? If I call the method in action-stae, I have to put the search results in flowscope so that second view can get the results - I am worried about memory in this scenario. If I call the method in second view- on-entry, I can put the personList in viewscope but how do I handle cases 2,4 and 5?

Thanks in advance!
            