# DataFlowController.jpf Sample

This topic inludes the source code for the DataFlowController.jpf Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/handlingData/dataFlow/

## Sample Source Code

`001 package handlingData.dataFlow; 002 003 import com.bea.wlw.netui.pageflow.FormData; 004 import com.bea.wlw.netui.pageflow.Forward; 005 import com.bea.wlw.netui.pageflow.PageFlowController; 006 import javax.servlet.http.HttpServletRequest; 007 008 009 /** 010 * @jpf:forward name="error" path="error.jsp" 011 * @jpf:view-properties view-properties:: 012 * <!-- This data is auto-generated. Hand-editing this section is not recommended. --> 013 * <view-properties> 014 * <pageflow-object id="pageflow:/handlingData/dataFlow/dataFlowController.jpf"/> 015 * <pageflow-object id="action:begin.do"> 016 * <property name="x" value="60"/> 017 * <property name="y" value="60"/> 018 * </pageflow-object> 019 * <pageflow-object id="action:start.do"> 020 * <property value="60" name="x"/> 021 * <property value="340" name="y"/> 022 * </pageflow-object> 023 * <pageflow-object id="action:firstNameAction.do#handlingData.dataFlow.dataFlowController.NameActionForm"> 024 * <property value="260" name="x"/> 025 * <property value="340" name="y"/> 026 * </pageflow-object> 027 * <pageflow-object id="action:lastNameAction.do#handlingData.dataFlow.dataFlowController.NameActionForm"> 028 * <property value="460" name="x"/> 029 * <property value="340" name="y"/> 030 * </pageflow-object> 031 * <pageflow-object id="action:confirm.do#handlingData.dataFlow.dataFlowController.NameActionForm"> 032 * <property value="640" name="x"/> 033 * <property value="340" name="y"/> 034 * </pageflow-object> 035 * <pageflow-object id="action:done.do#handlingData.dataFlow.dataFlowController.NameActionForm"> 036 * <property value="740" name="x"/> 037 * <property value="60" name="y"/> 038 * </pageflow-object> 039 * <pageflow-object id="action:cancel.do"> 040 * <property value="540" name="x"/> 041 * <property value="160" name="y"/> 042 * </pageflow-object> 043 * <pageflow-object id="page:error.jsp"> 044 * <property name="x" value="740"/> 045 * <property name="y" value="300"/> 046 * </pageflow-object> 047 * <pageflow-object id="action-call:@page:index.jsp@#@action:start.do@"> 048 * <property value="60,60,60,60" name="elbowsX"/> 049 * <property value="204,250,250,296" name="elbowsY"/> 050 * <property value="South_1" name="fromPort"/> 051 * <property value="North_1" name="toPort"/> 052 * </pageflow-object> 053 * <pageflow-object id="page:index.jsp"> 054 * <property name="x" value="60"/> 055 * <property name="y" value="160"/> 056 * </pageflow-object> 057 * <pageflow-object id="action-call:@page:firstName.jsp@#@action:firstNameAction.do#handlingData.dataFlow.dataFlowController.NameActionForm@"> 058 * <property value="196,210,210,224" name="elbowsX"/> 059 * <property value="332,332,332,332" name="elbowsY"/> 060 * <property value="East_1" name="fromPort"/> 061 * <property value="West_1" name="toPort"/> 062 * </pageflow-object> 063 * <pageflow-object id="page:firstName.jsp"> 064 * <property name="x" value="160"/> 065 * <property name="y" value="340"/> 066 * </pageflow-object> 067 * <pageflow-object id="action-call:@page:lastName.jsp@#@action:lastNameAction.do#handlingData.dataFlow.dataFlowController.NameActionForm@"> 068 * <property value="396,410,410,424" name="elbowsX"/> 069 * <property value="332,332,332,332" name="elbowsY"/> 070 * <property value="East_1" name="fromPort"/> 071 * <property value="West_1" name="toPort"/> 072 * </pageflow-object> 073 * <pageflow-object id="page:lastName.jsp"> 074 * <property name="x" value="360"/> 075 * <property name="y" value="340"/> 076 * </pageflow-object> 077 * <pageflow-object id="action-call:@page:confirm.jsp@#@action:confirm.do#handlingData.dataFlow.dataFlowController.NameActionForm@"> 078 * <property value="576,590,590,604" name="elbowsX"/> 079 * <property value="332,332,332,332" name="elbowsY"/> 080 * <property value="East_1" name="fromPort"/> 081 * <property value="West_1" name="toPort"/> 082 * </pageflow-object> 083 * <pageflow-object id="action-call:@page:confirm.jsp@#@action:cancel.do@"> 084 * <property value="540,540,540,540" name="elbowsX"/> 085 * <property value="296,250,250,204" name="elbowsY"/> 086 * <property value="North_1" name="fromPort"/> 087 * <property value="South_1" name="toPort"/> 088 * </pageflow-object> 089 * <pageflow-object id="page:confirm.jsp"> 090 * <property name="x" value="540"/> 091 * <property name="y" value="340"/> 092 * </pageflow-object> 093 * <pageflow-object id="action-call:@page:done.jsp@#@action:begin.do@"> 094 * <property value="604,350,350,96" name="elbowsX"/> 095 * <property value="52,52,52,52" name="elbowsY"/> 096 * <property value="West_1" name="fromPort"/> 097 * <property value="East_1" name="toPort"/> 098 * </pageflow-object> 099 * <pageflow-object id="action-call:@page:done.jsp@#@action:done.do#handlingData.dataFlow.dataFlowController.NameActionForm@"> 100 * <property value="676,690,690,704" name="elbowsX"/> 101 * <property value="52,52,52,52" name="elbowsY"/> 102 * <property value="East_1" name="fromPort"/> 103 * <property value="West_1" name="toPort"/> 104 * </pageflow-object> 105 * <pageflow-object id="page:done.jsp"> 106 * <property name="x" value="640"/> 107 * <property name="y" value="60"/> 108 * </pageflow-object> 109 * <pageflow-object id="external-jpf:/Controller.jpf"> 110 * <property name="x" value="740"/> 111 * <property name="y" value="180"/> 112 * </pageflow-object> 113 * <pageflow-object id="forward:path#index#index.jsp#@action:begin.do@"> 114 * <property name="elbowsY" value="104,110,110,116"/> 115 * <property name="toPort" value="North_1"/> 116 * <property name="elbowsX" value="60,60,60,60"/> 117 * <property name="label" value="index"/> 118 * <property name="fromPort" value="South_1"/> 119 * </pageflow-object> 120 * <pageflow-object id="forward:path#success#firstName.jsp#@action:start.do@"> 121 * <property value="96,110,110,124" name="elbowsX"/> 122 * <property value="332,332,332,332" name="elbowsY"/> 123 * <property value="East_1" name="fromPort"/> 124 * <property value="West_1" name="toPort"/> 125 * <property value="success" name="label"/> 126 * </pageflow-object> 127 * <pageflow-object id="forward:path#success#lastName.jsp#@action:firstNameAction.do#handlingData.dataFlow.dataFlowController.NameActionForm@"> 128 * <property value="296,310,310,324" name="elbowsX"/> 129 * <property value="332,332,332,332" name="elbowsY"/> 130 * <property value="East_1" name="fromPort"/> 131 * <property value="West_1" name="toPort"/> 132 * <property value="success" name="label"/> 133 * </pageflow-object> 134 * <pageflow-object id="forward:path#success#confirm.jsp#@action:lastNameAction.do#handlingData.dataFlow.dataFlowController.NameActionForm@"> 135 * <property value="496,500,500,504" name="elbowsX"/> 136 * <property value="332,332,332,332" name="elbowsY"/> 137 * <property value="East_1" name="fromPort"/> 138 * <property value="West_1" name="toPort"/> 139 * <property value="success" name="label"/> 140 * </pageflow-object> 141 * <pageflow-object id="forward:path#success#done.jsp#@action:confirm.do#handlingData.dataFlow.dataFlowController.NameActionForm@"> 142 * <property value="640,640,640,640" name="elbowsX"/> 143 * <property value="296,200,200,104" name="elbowsY"/> 144 * <property value="North_1" name="fromPort"/> 145 * <property value="South_1" name="toPort"/> 146 * <property value="success" name="label"/> 147 * </pageflow-object> 148 * <pageflow-object id="forward:path#success#/Controller.jpf#@action:done.do#handlingData.dataFlow.dataFlowController.NameActionForm@"> 149 * <property value="740,740,740,740" name="elbowsX"/> 150 * <property value="104,120,120,136" name="elbowsY"/> 151 * <property value="South_1" name="fromPort"/> 152 * <property value="North_1" name="toPort"/> 153 * <property value="success" name="label"/> 154 * </pageflow-object> 155 * <pageflow-object id="forward:path#success#index.jsp#@action:cancel.do@"> 156 * <property value="504,300,300,96" name="elbowsX"/> 157 * <property value="152,152,152,152" name="elbowsY"/> 158 * <property value="West_1" name="fromPort"/> 159 * <property value="East_1" name="toPort"/> 160 * <property value="success" name="label"/> 161 * </pageflow-object> 162 * <pageflow-object id="formbeanprop:handlingData.dataFlow.dataFlowController.NameActionForm#lastname#java.lang.String"/> 163 * <pageflow-object id="formbeanprop:handlingData.dataFlow.dataFlowController.NameActionForm#firstname#java.lang.String"/> 164 * <pageflow-object id="formbean:handlingData.dataFlow.dataFlowController.NameActionForm"/> 165 * <pageflow-object id="forward:path#error#error.jsp"/> 166 * </view-properties> 167 * :: 168 * 169 */ 170 public class dataFlowController extends PageFlowController 171 { 172 /* 173 * This instance of the Form Bean NameActionForm has the same life-cycle as the 174 * Controller file. As long as the Controller file instance exists, pageFlowScopedBean 175 * exists as well and can continue to accumulate state. 176 */ 177 public NameActionForm pageFlowScopedBean = new NameActionForm(); 178 179 /** 180 * @jpf:action 181 * @jpf:forward name="index" path="index.jsp" 182 */ 183 protected Forward begin() 184 { 185 return new Forward( "index" ); 186 } 187 188 /** 189 * @jpf:action 190 * @jpf:forward name="success" path="firstName.jsp" 191 */ 192 protected Forward start() 193 { 194 return new Forward("success"); 195 } 196 197 /** 198 * This method is passed the page-flow-scoped Form Bean pageFlowScopedBean. 199 * 200 * If the annotation 201 * 202 * jpf:action form="pageFlowScopedBean" 203 * 204 * were not present, this method would be passed a new instance of the Form Bean 205 * and that instance would be request-scoped, not page-flow-scoped. 206 * 207 * @jpf:action form="pageFlowScopedBean" 208 * @jpf:forward name="success" path="lastName.jsp" 209 */ 210 public Forward firstNameAction(NameActionForm form) 211 { 212 return new Forward( "success" ); 213 } 214 215 /** 216 * @jpf:action form="pageFlowScopedBean" 217 * @jpf:forward name="success" path="confirm.jsp" 218 */ 219 public Forward lastNameAction(NameActionForm form) 220 { 221 return new Forward( "success" ); 222 } 223 224 /** 225 * @jpf:action form="pageFlowScopedBean" 226 * @jpf:forward name="success" path="done.jsp" 227 */ 228 public Forward confirm(NameActionForm form) 229 { 230 return new Forward( "success" ); 231 } 232 233 /** 234 * @jpf:action form="pageFlowScopedBean" 235 * @jpf:forward name="success" path="/Controller.jpf" 236 */ 237 public Forward done(NameActionForm form) 238 { 239 return new Forward( "success" ); 240 } 241 242 /** 243 * @jpf:action 244 * @jpf:forward name="success" path="index.jsp" 245 */ 246 protected Forward cancel() 247 { 248 return new Forward("success"); 249 } 250 251 public static class NameActionForm extends com.bea.wlw.netui.pageflow.FormData 252 { 253 private java.lang.String firstname; 254 private java.lang.String lastname; 255 256 public void setLastname(java.lang.String lastname) 257 { this.lastname = lastname; } 258 259 public java.lang.String getLastname() 260 { return this.lastname; } 261 262 public void setFirstname(java.lang.String firstname) 263 { this.firstname = firstname; } 264 265 public java.lang.String getFirstname() 266 { return this.firstname; } 267 } 268 269 270 271 }`