CheckBoxController.jpf Sample

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

Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui/checkBox/

Sample Source Code


01 package tagSamples.netui.checkBox;
02 import com.bea.wlw.netui.pageflow.FormData;
03 import com.bea.wlw.netui.pageflow.Forward;
04 import com.bea.wlw.netui.pageflow.PageFlowController;
05 
06 /**
07  * @jpf:controller
08  * @jpf:view-properties view-properties::
09  <!-- This data is auto-generated. Hand-editing this section is not recommended. -->
10  <view-properties>
11  <pageflow-object id="pageflow:/tagSamples/checkBox/CheckBoxController.jpf"/>
12  <pageflow-object id="action:begin.do#tagSamples.checkBox.CheckBoxController.ProcessDataForm">
13  *   <property value="80" name="x"/>
14  *   <property value="100" name="y"/>
15  </pageflow-object>
16  <pageflow-object id="page:index.jsp">
17  *   <property value="240" name="x"/>
18  *   <property value="100" name="y"/>
19  </pageflow-object>
20  <pageflow-object id="forward:path#success#index.jsp#@action:begin.do#tagSamples.checkBox.CheckBoxController.ProcessDataForm@">
21  *   <property value="116,160,160,204" name="elbowsX"/>
22  *   <property value="92,92,92,92" name="elbowsY"/>
23  *   <property value="East_1" name="fromPort"/>
24  *   <property value="West_1" name="toPort"/>
25  *   <property value="success" name="label"/>
26  </pageflow-object>
27  <pageflow-object id="formbean:tagSamples.checkBox.CheckBoxController.ProcessDataForm"/>
28  <pageflow-object id="action:processData.do#tagSamples.checkBox.CheckBoxController.ProcessDataForm">
29  *   <property value="360" name="x"/>
30  *   <property value="100" name="y"/>
31  </pageflow-object>
32  <pageflow-object id="action-call:@page:index.jsp@#@action:processData.do#tagSamples.checkBox.CheckBoxController.ProcessDataForm@">
33  *   <property value="276,300,300,324" name="elbowsX"/>
34  *   <property value="92,92,92,92" name="elbowsY"/>
35  *   <property value="East_1" name="fromPort"/>
36  *   <property value="West_1" name="toPort"/>
37  </pageflow-object>
38  <pageflow-object id="page:showData.jsp">
39  *   <property value="480" name="x"/>
40  *   <property value="100" name="y"/>
41  </pageflow-object>
42  <pageflow-object id="formbeanprop:tagSamples.checkBox.CheckBoxController.ProcessDataForm#wantsSpecialOffers#boolean"/>
43  <pageflow-object id="forward:path#success#showData.jsp#@action:processData.do#tagSamples.checkBox.CheckBoxController.ProcessDataForm@">
44  *   <property value="396,420,420,444" name="elbowsX"/>
45  *   <property value="92,92,92,92" name="elbowsY"/>
46  *   <property value="East_1" name="fromPort"/>
47  *   <property value="West_1" name="toPort"/>
48  *   <property value="success" name="label"/>
49  </pageflow-object>
50  </view-properties>
51  * ::
52  */
53 public class CheckBoxController extends PageFlowController
54 {
55     /**
56      * @jpf:action
57      * @jpf:forward name="success" path="index.jsp"
58      */
59     protected Forward begin(ProcessDataForm form)
60     {
61         // Set the default value to true.
62         form.setWantsSpecialOffers(true);
63         
64         return new Forward("success");
65     }
66 
67     /**
68      * @jpf:action
69      * @jpf:forward name="success" path="showData.jsp"
70      */
71     protected Forward processData(ProcessDataForm form)
72     {
73         // Place the submitted data on the request Object.
74         getRequest().setAttribute("submittedData", form);
75         
76         return new Forward("success");
77     }
78 
79     /**
80      * FormData get and set methods may be overwritten by the Form Bean editor.
81      */
82     public static class ProcessDataForm extends FormData
83     {
84         private boolean wantsSpecialOffers;
85 
86         private boolean currentMember;
87 
88         public void setWantsSpecialOffers(boolean wantsSpecialOffers)
89         {
90             this.wantsSpecialOffers = wantsSpecialOffers;
91         }
92 
93         public boolean isWantsSpecialOffers()
94         {
95             return this.wantsSpecialOffers;
96         }
97     }
98 }