gmmehta
Feb 25th, 2008, 02:50 AM
Hello All,
I am new to swf and am having problems obtaining user selection after subflow has finshed.
I have a main page where it displays a form with fields and buttons. There is a 'select address' button which when clicked calls a subflow. This subflow when invoked displays a page with a list of addresses together with radio buttons. When the user selects a radio button and clicks 'select' I want the selected 'addressId' associated with the radio button to be passed back to the main webflow. In the subflow definition I am getting the selected 'addressId' from externalContext.requestParameterMap and setting it into the conversation scope.
And to be honst I have tried various combinations to get the 'addressId' in the main flow ... but unsuccessful. ( I don't know if this is the right way of doing things )
The flows are defined as follows:
// START main flow xml file
....
<view-state id="selectProduct" view="selectProductFormView">
<render-actions>
<action bean="selectProductFormAction" method="setupForm"/>
</render-actions>
<!--- ***** CALLS THE SUBFLOW **** --->
<transition on="select" to="subFlowSelectAddress" />
<transition on="submit" to="processSelectProductSubmit">
<action bean="selectProductFormAction" method="bindAndValidate"/>
</transition>
</view-state>
<subflow-state id="subFlowSelectAddress" flow="select-address-flow">
<attribute-mapper>
<input-mapper>
<mapping source="flowScope.accountId" target="pAccountId"/>
<mapping source="flowScope.username" target="pUsername"/>
</input-mapper>
<!----- WHICH SCOPE SHOULD THIS OUTPUT COME BACK IN?????? ---->
<output-mapper>
<output-attribute name="addressId"
scope="request"/>
</output-mapper>
</attribute-mapper>
<transition on="finish" to="selectProduct" />
</subflow-state>
.....
// END main flow xml file
// START subflow xml file
...
<start-state idref="selectAddress"/>
<view-state id="selectAddress" view="selectAddressView">
<render-actions>
<bean-action bean="selectProductFormAction" method="findAddresses">
<method-arguments>
<argument expression="flowScope.pAccountId" />
<argument expression="flowScope.pUsername" />
</method-arguments>
<method-result name="addresses" />
</bean-action>
</render-actions>
<transition on="select" to="finish" />
</view-state>
<end-state id="finish">
<output-mapper>
<output-attribute name="addressId" scope="conversation"/>
<mapping
source="externalContext.requestParameterMap.addressId"
target="addressId" />
</output-mapper>
</end-state>
...
// END subflow xml file
// START selectAddresses.jsp
<form action="${flowExecutionKey}" method="post">
<input type="hidden" name="_flowExecutionKey"
value="${flowExecutionKey}"/>
<table>
<c:forEach var="add" items="${addresses}">
<tr height="20" bgcolor="#EEEEEE">
<td>
<input type="radio" name="addressId" value="${add.id}"/>
</td>
<td>${add.line1}</td>
<td>${add.line2}</td>
<td>${add.line3}</td>
<td>${add.postCode}</td>
</tr>
</c:forEach>
<tr>
<td>
<input type="submit" name="_eventId_select" value="select" />
</td>
</tr>
</table>
</form>
...
// END selectAddresses.jsp
Hope someone can help out...
Thanks in advance.
gautam
I am new to swf and am having problems obtaining user selection after subflow has finshed.
I have a main page where it displays a form with fields and buttons. There is a 'select address' button which when clicked calls a subflow. This subflow when invoked displays a page with a list of addresses together with radio buttons. When the user selects a radio button and clicks 'select' I want the selected 'addressId' associated with the radio button to be passed back to the main webflow. In the subflow definition I am getting the selected 'addressId' from externalContext.requestParameterMap and setting it into the conversation scope.
And to be honst I have tried various combinations to get the 'addressId' in the main flow ... but unsuccessful. ( I don't know if this is the right way of doing things )
The flows are defined as follows:
// START main flow xml file
....
<view-state id="selectProduct" view="selectProductFormView">
<render-actions>
<action bean="selectProductFormAction" method="setupForm"/>
</render-actions>
<!--- ***** CALLS THE SUBFLOW **** --->
<transition on="select" to="subFlowSelectAddress" />
<transition on="submit" to="processSelectProductSubmit">
<action bean="selectProductFormAction" method="bindAndValidate"/>
</transition>
</view-state>
<subflow-state id="subFlowSelectAddress" flow="select-address-flow">
<attribute-mapper>
<input-mapper>
<mapping source="flowScope.accountId" target="pAccountId"/>
<mapping source="flowScope.username" target="pUsername"/>
</input-mapper>
<!----- WHICH SCOPE SHOULD THIS OUTPUT COME BACK IN?????? ---->
<output-mapper>
<output-attribute name="addressId"
scope="request"/>
</output-mapper>
</attribute-mapper>
<transition on="finish" to="selectProduct" />
</subflow-state>
.....
// END main flow xml file
// START subflow xml file
...
<start-state idref="selectAddress"/>
<view-state id="selectAddress" view="selectAddressView">
<render-actions>
<bean-action bean="selectProductFormAction" method="findAddresses">
<method-arguments>
<argument expression="flowScope.pAccountId" />
<argument expression="flowScope.pUsername" />
</method-arguments>
<method-result name="addresses" />
</bean-action>
</render-actions>
<transition on="select" to="finish" />
</view-state>
<end-state id="finish">
<output-mapper>
<output-attribute name="addressId" scope="conversation"/>
<mapping
source="externalContext.requestParameterMap.addressId"
target="addressId" />
</output-mapper>
</end-state>
...
// END subflow xml file
// START selectAddresses.jsp
<form action="${flowExecutionKey}" method="post">
<input type="hidden" name="_flowExecutionKey"
value="${flowExecutionKey}"/>
<table>
<c:forEach var="add" items="${addresses}">
<tr height="20" bgcolor="#EEEEEE">
<td>
<input type="radio" name="addressId" value="${add.id}"/>
</td>
<td>${add.line1}</td>
<td>${add.line2}</td>
<td>${add.line3}</td>
<td>${add.postCode}</td>
</tr>
</c:forEach>
<tr>
<td>
<input type="submit" name="_eventId_select" value="select" />
</td>
</tr>
</table>
</form>
...
// END selectAddresses.jsp
Hope someone can help out...
Thanks in advance.
gautam