# MultipleFormsController.jpf Sample

This topic inludes the source code for the MultipleFormsController.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/multipleForms/

## Sample Source Code

`001 package handlingData.multipleForms; 002 003 import com.bea.wlw.netui.pageflow.*; 004 005 006 /** 007 * @jpf:view-properties view-properties:: 008 * <!-- This data is auto-generated. Hand-editing this section is not recommended. --> 009 * <view-properties> 010 * <pageflow-object id="pageflow:/handlingData/multipleForms/multipleFormsController.jpf"/> 011 * <pageflow-object id="action:begin.do"> 012 * <property value="60" name="x"/> 013 * <property value="60" name="y"/> 014 * </pageflow-object> 015 * <pageflow-object id="action:goFormPageWithoutValues.do"> 016 * <property value="160" name="x"/> 017 * <property value="300" name="y"/> 018 * </pageflow-object> 019 * <pageflow-object id="action:goFormPageWithValues.do"> 020 * <property value="160" name="x"/> 021 * <property value="120" name="y"/> 022 * </pageflow-object> 023 * <pageflow-object id="action:submitForm1.do#handlingData.multipleForms.multipleFormsController.Form1"> 024 * <property value="500" name="x"/> 025 * <property value="100" name="y"/> 026 * </pageflow-object> 027 * <pageflow-object id="action:submitForm2.do#handlingData.multipleForms.multipleFormsController.Form2"> 028 * <property value="500" name="x"/> 029 * <property value="300" name="y"/> 030 * </pageflow-object> 031 * <pageflow-object id="action-call:@page:selectFormPage.jsp@#@action:goFormPageWithoutValues.do@"> 032 * <property value="96,110,110,124" name="elbowsX"/> 033 * <property value="212,212,292,292" name="elbowsY"/> 034 * <property value="East_1" name="fromPort"/> 035 * <property value="West_1" name="toPort"/> 036 * </pageflow-object> 037 * <pageflow-object id="action-call:@page:selectFormPage.jsp@#@action:goFormPageWithValues.do@"> 038 * <property value="96,110,110,124" name="elbowsX"/> 039 * <property value="212,212,112,112" name="elbowsY"/> 040 * <property value="East_1" name="fromPort"/> 041 * <property value="West_1" name="toPort"/> 042 * </pageflow-object> 043 * <pageflow-object id="page:selectFormPage.jsp"> 044 * <property value="60" name="x"/> 045 * <property value="220" name="y"/> 046 * </pageflow-object> 047 * <pageflow-object id="action-call:@page:formPage.jsp@#@action:begin.do@"> 048 * <property value="284,190,190,96" name="elbowsX"/> 049 * <property value="52,52,52,52" name="elbowsY"/> 050 * <property value="West_1" name="fromPort"/> 051 * <property value="East_1" name="toPort"/> 052 * </pageflow-object> 053 * <pageflow-object id="action-call:@page:formPage.jsp@#@action:submitForm1.do#handlingData.multipleForms.multipleFormsController.Form1@"> 054 * <property value="356,410,410,464" name="elbowsX"/> 055 * <property value="52,52,92,92" name="elbowsY"/> 056 * <property value="East_1" name="fromPort"/> 057 * <property value="West_1" name="toPort"/> 058 * </pageflow-object> 059 * <pageflow-object id="action-call:@page:formPage.jsp@#@action:submitForm2.do#handlingData.multipleForms.multipleFormsController.Form2@"> 060 * <property value="356,410,410,464" name="elbowsX"/> 061 * <property value="52,52,292,292" name="elbowsY"/> 062 * <property value="East_1" name="fromPort"/> 063 * <property value="West_1" name="toPort"/> 064 * </pageflow-object> 065 * <pageflow-object id="page:formPage.jsp"> 066 * <property value="320" name="x"/> 067 * <property value="60" name="y"/> 068 * </pageflow-object> 069 * <pageflow-object id="forward:path#page1#selectFormPage.jsp#@action:begin.do@"> 070 * <property value="60,60,60,60" name="elbowsX"/> 071 * <property value="104,140,140,176" name="elbowsY"/> 072 * <property value="South_1" name="fromPort"/> 073 * <property value="North_1" name="toPort"/> 074 * <property value="page1" name="label"/> 075 * </pageflow-object> 076 * <pageflow-object id="forward:path#formPage#formPage.jsp#@action:goFormPageWithoutValues.do@"> 077 * <property value="196,240,240,284" name="elbowsX"/> 078 * <property value="292,292,52,52" name="elbowsY"/> 079 * <property value="East_1" name="fromPort"/> 080 * <property value="West_1" name="toPort"/> 081 * <property value="formPage" name="label"/> 082 * </pageflow-object> 083 * <pageflow-object id="forward:path#formPage#formPage.jsp#@action:goFormPageWithValues.do@"> 084 * <property value="196,240,240,284" name="elbowsX"/> 085 * <property value="112,112,52,52" name="elbowsY"/> 086 * <property value="East_1" name="fromPort"/> 087 * <property value="West_1" name="toPort"/> 088 * <property value="formPage" name="label"/> 089 * </pageflow-object> 090 * <pageflow-object id="forward:path#formPage#formPage.jsp#@action:submitForm1.do#handlingData.multipleForms.multipleFormsController.Form1@"> 091 * <property value="464,410,410,356" name="elbowsX"/> 092 * <property value="92,92,52,52" name="elbowsY"/> 093 * <property value="West_1" name="fromPort"/> 094 * <property value="East_1" name="toPort"/> 095 * <property value="formPage" name="label"/> 096 * </pageflow-object> 097 * <pageflow-object id="forward:path#formPage#formPage.jsp#@action:submitForm2.do#handlingData.multipleForms.multipleFormsController.Form2@"> 098 * <property value="464,410,410,356" name="elbowsX"/> 099 * <property value="292,292,52,52" name="elbowsY"/> 100 * <property value="West_1" name="fromPort"/> 101 * <property value="East_1" name="toPort"/> 102 * <property value="formPage" name="label"/> 103 * </pageflow-object> 104 * <pageflow-object id="formbeanprop:handlingData.multipleForms.multipleFormsController.Form1#fieldA#java.lang.String"/> 105 * <pageflow-object id="formbeanprop:handlingData.multipleForms.multipleFormsController.Form1#fieldB#java.lang.String"/> 106 * <pageflow-object id="formbean:handlingData.multipleForms.multipleFormsController.Form1"/> 107 * <pageflow-object id="formbeanprop:handlingData.multipleForms.multipleFormsController.Form2#fieldA#java.lang.String"/> 108 * <pageflow-object id="formbeanprop:handlingData.multipleForms.multipleFormsController.Form2#fieldB#java.lang.String"/> 109 * <pageflow-object id="formbean:handlingData.multipleForms.multipleFormsController.Form2"/> 110 * </view-properties> 111 * :: 112 * 113 */ 114 public class multipleFormsController extends PageFlowController 115 { 116 public String message = ""; 117 118 /** 119 * @jpf:action 120 * @jpf:forward name="page1" path="selectFormPage.jsp" 121 */ 122 public Forward begin() 123 { 124 return new Forward( "page1" ); 125 } 126 127 /** 128 * @jpf:action 129 * @jpf:forward name="formPage" path="formPage.jsp" 130 */ 131 public Forward goFormPageWithoutValues() 132 { 133 return new Forward( "formPage" ); 134 } 135 136 /** 137 * @jpf:action 138 * @jpf:forward name="formPage" path="formPage.jsp" 139 */ 140 public Forward goFormPageWithValues() 141 { 142 Forward fwd = new Forward( "formPage" ); 143 144 Form1 form1 = new Form1(); 145 form1.fieldA = "Form 1, field A"; 146 form1.fieldB = "Form 1, field B"; 147 fwd.addOutputForm( form1 ); 148 149 Form2 form2 = new Form2(); 150 form2.fieldA = "Form 2, field A"; 151 form2.fieldB = "Form 2, field B"; 152 fwd.addOutputForm( form2 ); 153 154 return fwd; 155 } 156 157 /** 158 * @jpf:action 159 * @jpf:forward name="formPage" path="formPage.jsp" 160 */ 161 public Forward submitForm1( Form1 form ) 162 { 163 message = "submitted Form 1 -- Field A = \"" + form.fieldA + "\", Field B = \"" + form.fieldB + "\""; 164 return new Forward( "formPage" ); 165 } 166 167 /** 168 * @jpf:action 169 * @jpf:forward name="formPage" path="formPage.jsp" 170 */ 171 public Forward submitForm2( Form2 form ) 172 { 173 message = "submitted Form 2 -- Field A = \"" + form.fieldA + "\", Field B = \"" + form.fieldB + "\""; 174 return new Forward( "formPage" ); 175 } 176 177 178 public static class Form1 extends FormData 179 { 180 private String fieldB; 181 182 private String fieldA; 183 184 public String foo; 185 186 public void setFieldA(String fieldA) 187 { 188 this.fieldA = fieldA; 189 } 190 191 public String getFieldA() 192 { 193 return this.fieldA; 194 } 195 196 public void setFieldB(String fieldB) 197 { 198 this.fieldB = fieldB; 199 } 200 201 public String getFieldB() 202 { 203 return this.fieldB; 204 } 205 } 206 207 public static class Form2 extends FormData 208 { 209 private String fieldB; 210 211 private String fieldA; 212 213 public String bar; 214 215 public void setFieldA(String fieldA) 216 { 217 this.fieldA = fieldA; 218 } 219 220 public String getFieldA() 221 { 222 return this.fieldA; 223 } 224 225 public void setFieldB(String fieldB) 226 { 227 this.fieldB = fieldB; 228 } 229 230 public String getFieldB() 231 { 232 return this.fieldB; 233 } 234 } 235 236 }`