# ButtonController.jpf Sample

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

## Sample Source Code

`001 package tagSamples.netui.button; 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/button/ButtonController.jpf"/> 013 * <pageflow-object id="action:begin.do"> 014 * <property value="80" name="x"/> 015 * <property value="120" name="y"/> 016 * </pageflow-object> 017 * <pageflow-object id="action:processA.do#tagSamples.netui.button.ButtonController.ProcessDataForm"> 018 * <property value="360" name="x"/> 019 * <property value="240" name="y"/> 020 * </pageflow-object> 021 * <pageflow-object id="action:processB.do#tagSamples.netui.button.ButtonController.ProcessDataForm"> 022 * <property value="360" name="x"/> 023 * <property value="120" name="y"/> 024 * </pageflow-object> 025 * <pageflow-object id="action-call:@page:index.jsp@#@action:processB.do#tagSamples.netui.button.ButtonController.ProcessDataForm@"> 026 * <property value="256,290,290,324" name="elbowsX"/> 027 * <property value="172,172,112,112" name="elbowsY"/> 028 * <property value="East_1" name="fromPort"/> 029 * <property value="West_1" name="toPort"/> 030 * </pageflow-object> 031 * <pageflow-object id="action-call:@page:index.jsp@#@action:processA.do#tagSamples.netui.button.ButtonController.ProcessDataForm@"> 032 * <property value="256,290,290,324" name="elbowsX"/> 033 * <property value="183,183,232,232" name="elbowsY"/> 034 * <property value="East_2" name="fromPort"/> 035 * <property value="West_1" name="toPort"/> 036 * </pageflow-object> 037 * <pageflow-object id="page:index.jsp"> 038 * <property value="220" name="x"/> 039 * <property value="180" name="y"/> 040 * </pageflow-object> 041 * <pageflow-object id="page:showData.jsp"> 042 * <property value="500" name="x"/> 043 * <property value="180" name="y"/> 044 * </pageflow-object> 045 * <pageflow-object id="forward:path#success#index.jsp#@action:begin.do@"> 046 * <property value="116,150,150,184" name="elbowsX"/> 047 * <property value="112,112,172,172" name="elbowsY"/> 048 * <property value="East_1" name="fromPort"/> 049 * <property value="West_1" name="toPort"/> 050 * <property value="success" name="label"/> 051 * </pageflow-object> 052 * <pageflow-object id="forward:path#success#showData.jsp#@action:processA.do#tagSamples.netui.button.ButtonController.ProcessDataForm@"> 053 * <property value="396,430,430,464" name="elbowsX"/> 054 * <property value="232,232,172,172" name="elbowsY"/> 055 * <property value="East_1" name="fromPort"/> 056 * <property value="West_1" name="toPort"/> 057 * <property value="success" name="label"/> 058 * </pageflow-object> 059 * <pageflow-object id="forward:path#success#showData.jsp#@action:processB.do#tagSamples.netui.button.ButtonController.ProcessDataForm@"> 060 * <property value="396,430,430,464" name="elbowsX"/> 061 * <property value="112,112,172,172" name="elbowsY"/> 062 * <property value="East_1" name="fromPort"/> 063 * <property value="West_1" name="toPort"/> 064 * <property value="success" name="label"/> 065 * </pageflow-object> 066 * <pageflow-object id="formbeanprop:tagSamples.netui.button.ButtonController.ProcessDataForm#firstname#java.lang.String"/> 067 * <pageflow-object id="formbeanprop:tagSamples.netui.button.ButtonController.ProcessDataForm#lastname#java.lang.String"/> 068 * <pageflow-object id="formbean:tagSamples.netui.button.ButtonController.ProcessDataForm"/> 069 * </view-properties> 070 * :: 071 */ 072 public class ButtonController extends PageFlowController 073 { 074 075 076 // Uncomment this declaration to access Global.app. 077 // 078 // protected global.Global globalApp; 079 // 080 081 // For an example of page flow exception handling see the example "catch" and "exception-handler" 082 // annotations in {project}/WEB-INF/src/global/Global.app 083 084 /** 085 * This method represents the point of entry into the pageflow 086 * @jpf:action 087 * @jpf:forward name="success" path="index.jsp" 088 */ 089 protected Forward begin() 090 { 091 return new Forward("success"); 092 } 093 094 /** 095 * @jpf:action 096 * @jpf:forward name="success" path="showData.jsp" 097 */ 098 protected Forward processA(ProcessDataForm form) 099 { 100 getRequest().setAttribute("submittedData", form); 101 return new Forward("success"); 102 } 103 104 /** 105 * @jpf:action 106 * @jpf:forward name="success" path="showData.jsp" 107 */ 108 protected Forward processB(ProcessDataForm form) 109 { 110 form.setFirstname( form.getFirstname().toUpperCase() ); 111 form.setLastname( form.getLastname().toUpperCase() ); 112 getRequest().setAttribute("submittedData", form); 113 return new Forward("success"); 114 } 115 116 117 /** 118 * FormData get and set methods may be overwritten by the Form Bean editor. 119 */ 120 public static class ProcessDataForm extends FormData 121 { 122 private String lastname; 123 124 private String firstname; 125 126 public void setFirstname(String firstname) 127 { 128 this.firstname = firstname; 129 } 130 131 public String getFirstname() 132 { 133 return this.firstname; 134 } 135 136 public void setLastname(String lastname) 137 { 138 this.lastname = lastname; 139 } 140 141 public String getLastname() 142 { 143 return this.lastname; 144 } 145 } 146 }`