16084

how to store value returned by a business service in a variable in spring web flow?

Question:

<strong>Situation :</strong> I am developing a spring mvc web flow app , in that i have two tables customer and customerAdress and two corresponding models : customerModel and customerAdressModel , now following is my flow.xml :

<var name="customer" class="com.model.Customer"/> <var name="customerAdress" class="com.model.CustomerAdress"/> <var name="id"> <view-state id="customer" view="customerView.jsp" model="customer"> <transition on="next" to="customerAdress"/> </view-state> <view-state id="customerAdress" view="customerAdressView.jsp" model="customerAdress"> <transition on="next" to="insertCustomer"/> </view-state> <action-state id="insertCustomer"> <evaluate expression="Buisness.insertCustomer(customer)"/> <evaluate expression="Buisness.fetchCustomerId(customer)" result="id"/> <evaluate expression="Buisness.insertCustomerAdress(id,cutomerAdress)"/> </action-state>

Now insertCustomer inserts customer , fetchCustomerId fetches customer's id and insertCusotomerAdress inserts adresses of customer by id

<strong>Problem :</strong> My problem is this code is not working , specifically insertCustomerAdress is not working , i think i have done some mistake in decalring id or assigning buisness service's value to id , can somebody please tell me proper syntax ?

Answer1:

By default action state executes only first action. To execute a chain of actions use <a href="http://docs.spring.io/spring-webflow/docs/2.4.2.RELEASE/reference/html/actions.html#named-actions" rel="nofollow">Named actions</a>.

<action-state id="insertCustomer"> <evaluate expression="Buisness.insertCustomer(customer)"> <attribute name="name" value="insertCustomer" /> </evaluate> <evaluate expression="Buisness.fetchCustomerId(customer)" result="id"> <attribute name="name" value="fetchCustomerId" /> </evaluate> <evaluate expression="Buisness.insertCustomerAdress(id,cutomerAdress)"> <attribute name="name" value="insertCustomerAdress" /> </evaluate> <transition on="insertCustomerAdress.success" to="[state id to transit]" /> </action-state>

Recommend

  • WPF Listbox commands
  • How to integrate Paytm with Codeigniter
  • Neo4j: Filter nodes based on aggregate function
  • calling a fragment from fragment
  • Regex for URL rewrite with optional query string parameters
  • What is this error in fortran and how to stop the program when it occurs?
  • Command line installation of Code Signing certificates, .p12 files, and mobileprovisions
  • Action Pack components in Rails
  • Can you pass an array from javascript to asp.net mvc controller action without using a form?
  • redirect_to root_url and return unless @user.activated
  • Magento get URL before current
  • Getting the scrolling offset when storing coordinates
  • How Get arguments value using inline assembly in C without Glibc?
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • How to make R's read_csv2() recognise the text characters properly
  • Implementing “partial void” in VB
  • Sending HTML Form Data to Spring REST Web Service
  • Implementation of State Monad
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • what is the difference between the asp.net mvc application and asp.net web application
  • Akka Routing: Reply's send to router ends up as dead letters
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • Getting Messege Twice Using IMvxMessenger
  • Java static initializers and reflection
  • How to stop GridView from loading again when I press back button?
  • unknown Exception android
  • MATLAB: Piecewise function in curve fitting toolbox using fittype
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • How can I use `wmic` in a Windows PE script?
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • Conditional In-Line CSS for IE and Others?
  • How to load view controller without button in storyboard?