This is my first flow and I'm wondering if I'm doing this correctly. Basically it's 3 pages, counting the end-state view. The user enters another person's uid and clicks search, that searches for the uid in our ldap directory, on the 2nd page it displays their ldap information and another form where the user can enter additional information; for example, the name of their store. Then they click submit and it adds it all to the database.
The object that's being built up and filled in is the Merchant (see the var at the top of the xml). After the ldap search I fill in a field of the Merchant object from the ldap information and that field is also displayed on the 2nd page in a form INPUT where the user can change it if they need to. So I'm wondering if there's a better way to fill in the Merchant object; currently I'm passing it to the ldap search and it's getting the uid from it and then filling in the field; it's modifying its parameter. I'm thinking I could fill in the field in the xml flow, but I haven't been able to figure out how to do that. And I'm wondering which way is better.
Thanks
Code:<?xml version="1.0" encoding="UTF-8"?> <flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd"> <var name="merchant" class="myapp.web.dto.Merchant" scope="flow" /> <start-state idref="addMerchantUid" /> <view-state id="addMerchantUid" view="addMerchantUid"> <render-actions> <action bean="addMerchant" method="setupForm" /> </render-actions> <transition on="submitUid" to="submitUid" /> </view-state> <action-state id="submitUid"> <action bean="addMerchant" method="bindAndValidate"> <attribute name="validatorMethod" value="validateUid" /> </action> <transition on="success" to="getLdapInfo" /> <transition on="error" to="addMerchantUid" /> </action-state> <action-state id="getLdapInfo"> <bean-action bean="merchantLdapInfo" method="ldapInfo"> <method-arguments> <argument expression="${flowScope.merchant}" /> </method-arguments> <method-result name="merchantInfo" scope="flow" /> </bean-action> <transition to="addMerchantInfo" /> </action-state> <view-state id="addMerchantInfo" view="addMerchantInfo"> <render-actions> <action bean="addMerchant" method="setupForm" /> </render-actions> <transition on="searchAgain" to="addMerchantUid" /> <transition on="submitInfo" to="submitInfo" /> </view-state> <action-state id="submitInfo"> <action bean="addMerchant" method="bindAndValidate"> <attribute name="validatorMethod" value="validateInfo" /> </action> <transition on="success" to="addMerchantOk" /> <transition on="error" to="addMerchantInfo" /> </action-state> <end-state id="addMerchantOk" view="addMerchantOk"> <output-mapper> <mapping source="flowScope.merchant" target="merchant" /> </output-mapper> </end-state> <import resource="addMerchant-beans.xml"/> </flow>


Reply With Quote