AnchorController.jpf Sample

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

Sample Source Code


001 package tagSamples.netui.anchor;
002 import com.bea.wlw.netui.pageflow.FormData;
003 import com.bea.wlw.netui.pageflow.Forward;
004 import com.bea.wlw.netui.pageflow.PageFlowController;
005 import java.util.Date;
006 
007 /**
008  * @jpf:controller
009  * @jpf:view-properties view-properties::
010  <!-- This data is auto-generated. Hand-editing this section is not recommended. -->
011  <view-properties>
012  <pageflow-object id="pageflow:/tagSamples/netui/anchor/AnchorController.jpf"/>
013  <pageflow-object id="action:begin.do">
014  *   <property value="80" name="x"/>
015  *   <property value="240" name="y"/>
016  </pageflow-object>
017  <pageflow-object id="action:formSubmit.do#tagSamples.netui.anchor.AnchorController.FormSubmitForm">
018  *   <property value="240" name="x"/>
019  *   <property value="120" name="y"/>
020  </pageflow-object>
021  <pageflow-object id="action:showCurrentTime.do">
022  *   <property value="360" name="x"/>
023  *   <property value="240" name="y"/>
024  </pageflow-object>
025  <pageflow-object id="action-call:@page:index.jsp@#@action:formSubmit.do#tagSamples.netui.anchor.AnchorController.FormSubmitForm@">
026  *   <property value="240,240,240,240" name="elbowsX"/>
027  *   <property value="196,180,180,164" name="elbowsY"/>
028  *   <property value="North_1" name="fromPort"/>
029  *   <property value="South_1" name="toPort"/>
030  </pageflow-object>
031  <pageflow-object id="action-call:@page:index.jsp@#@action:showCurrentTime.do@">
032  *   <property value="276,300,300,324" name="elbowsX"/>
033  *   <property value="232,232,232,232" name="elbowsY"/>
034  *   <property value="East_1" name="fromPort"/>
035  *   <property value="West_1" name="toPort"/>
036  </pageflow-object>
037  <pageflow-object id="page:index.jsp">
038  *   <property value="240" name="x"/>
039  *   <property value="240" name="y"/>
040  </pageflow-object>
041  <pageflow-object id="page:showData.jsp">
042  *   <property value="400" name="x"/>
043  *   <property value="120" name="y"/>
044  </pageflow-object>
045  <pageflow-object id="page:showCurrentTime.jsp">
046  *   <property value="520" name="x"/>
047  *   <property value="240" name="y"/>
048  </pageflow-object>
049  <pageflow-object id="page:linkPage.jsp">
050  *   <property value="240" name="x"/>
051  *   <property value="40" name="y"/>
052  </pageflow-object>
053  <pageflow-object id="forward:path#success#index.jsp#@action:begin.do@">
054  *   <property value="116,160,160,204" name="elbowsX"/>
055  *   <property value="232,232,232,232" name="elbowsY"/>
056  *   <property value="East_1" name="fromPort"/>
057  *   <property value="West_1" name="toPort"/>
058  *   <property value="success" name="label"/>
059  </pageflow-object>
060  <pageflow-object id="forward:path#success#showData.jsp#@action:formSubmit.do#tagSamples.netui.anchor.AnchorController.FormSubmitForm@">
061  *   <property value="276,320,320,364" name="elbowsX"/>
062  *   <property value="112,112,112,112" name="elbowsY"/>
063  *   <property value="East_1" name="fromPort"/>
064  *   <property value="West_1" name="toPort"/>
065  *   <property value="success" name="label"/>
066  </pageflow-object>
067  <pageflow-object id="forward:path#success#showCurrentTime.jsp#@action:showCurrentTime.do@">
068  *   <property value="396,440,440,484" name="elbowsX"/>
069  *   <property value="232,232,232,232" name="elbowsY"/>
070  *   <property value="East_1" name="fromPort"/>
071  *   <property value="West_1" name="toPort"/>
072  *   <property value="success" name="label"/>
073  </pageflow-object>
074  <pageflow-object id="formbeanprop:tagSamples.netui.anchor.AnchorController.FormSubmitForm#firstname#java.lang.String"/>
075  <pageflow-object id="formbeanprop:tagSamples.netui.anchor.AnchorController.FormSubmitForm#lastname#java.lang.String"/>
076  <pageflow-object id="formbean:tagSamples.netui.anchor.AnchorController.FormSubmitForm"/>
077  </view-properties>
078  * ::
079  */
080 public class AnchorController extends PageFlowController
081 {
082 
083 
084     // Uncomment this declaration to access Global.app.
085     // 
086     //     protected global.Global globalApp;
087     // 
088 
089     // For an example of page flow exception handling see the example "catch" and "exception-handler"
090     // annotations in {project}/WEB-INF/src/global/Global.app
091 
092     /**
093      * This method represents the point of entry into the pageflow
094      * @jpf:action
095      * @jpf:forward name="success" path="index.jsp"
096      */
097     protected Forward begin()
098     {
099         return new Forward("success");
100     }
101 
102     /**
103      * @jpf:action
104      * @jpf:forward name="success" path="showData.jsp"
105      */
106     protected Forward formSubmit(FormSubmitForm form)
107     {
108         getRequest().setAttribute("submittedData", form);
109         return new Forward("success");
110     }
111 
112     /**
113      * @jpf:action
114      * @jpf:forward name="success" path="showCurrentTime.jsp"
115      */
116     protected Forward showCurrentTime()
117     {
118         Date date = new java.util.Date();
119         System.out.println(date);
120         getRequest().setAttribute("date", date);
121         return new Forward("success");
122     }
123 
124     /**
125      * FormData get and set methods may be overwritten by the Form Bean editor.
126      */
127     public static class FormSubmitForm extends FormData
128     {
129         private String lastname;
130 
131         private String firstname;
132 
133         public void setFirstname(String firstname)
134         {
135             this.firstname = firstname;
136         }
137 
138         public String getFirstname()
139         {
140             return this.firstname;
141         }
142 
143         public void setLastname(String lastname)
144         {
145             this.lastname = lastname;
146         }
147 
148         public String getLastname()
149         {
150             return this.lastname;
151         }
152     }
153 }