# ShoppingController.jpf Sample

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

## Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/security/shoppingCartLogin/shopping/

## Sample Source Code

`001 package security.shoppingCartLogin.shopping; 002 003 import com.bea.wlw.netui.pageflow.Forward; 004 import com.bea.wlw.netui.pageflow.PageFlowController; 005 006 /** 007 * @jpf:controller 008 * @jpf:view-properties view-properties:: 009 * <!-- This data is auto-generated. Hand-editing this section is not recommended. --> 010 * <view-properties> 011 * <pageflow-object id="pageflow:/security/shoppingCartLogin/shopping/shoppingController.jpf"/> 012 * <pageflow-object id="action:begin.do"> 013 * <property value="80" name="x"/> 014 * <property value="60" name="y"/> 015 * </pageflow-object> 016 * <pageflow-object id="action:save.do"> 017 * <property value="400" name="x"/> 018 * <property value="300" name="y"/> 019 * </pageflow-object> 020 * <pageflow-object id="action:loginCancel.do"> 021 * <property value="500" name="x"/> 022 * <property value="80" name="y"/> 023 * </pageflow-object> 024 * <pageflow-object id="action:loginSuccess.do"> 025 * <property value="680" name="x"/> 026 * <property value="80" name="y"/> 027 * </pageflow-object> 028 * <pageflow-object id="action:doLogout.do"> 029 * <property value="240" name="x"/> 030 * <property value="180" name="y"/> 031 * </pageflow-object> 032 * <pageflow-object id="action:doLogoutSamplesHome.do"> 033 * <property value="80" name="x"/> 034 * <property value="400" name="y"/> 035 * </pageflow-object> 036 * <pageflow-object id="action-call:@page:index.jsp@#@action:save.do@"> 037 * <property value="400,400,400,400" name="elbowsX"/> 038 * <property value="104,180,180,256" name="elbowsY"/> 039 * <property value="South_1" name="fromPort"/> 040 * <property value="North_1" name="toPort"/> 041 * </pageflow-object> 042 * <pageflow-object id="page:index.jsp"> 043 * <property value="400" name="x"/> 044 * <property value="60" name="y"/> 045 * </pageflow-object> 046 * <pageflow-object id="action-call:@page:success.jsp@#@action:doLogoutSamplesHome.do@"> 047 * <property value="80,80,80,80" name="elbowsX"/> 048 * <property value="344,350,350,356" name="elbowsY"/> 049 * <property value="South_1" name="fromPort"/> 050 * <property value="North_1" name="toPort"/> 051 * </pageflow-object> 052 * <pageflow-object id="action-call:@page:success.jsp@#@action:begin.do@"> 053 * <property value="80,80,80,80" name="elbowsX"/> 054 * <property value="256,180,180,104" name="elbowsY"/> 055 * <property value="North_1" name="fromPort"/> 056 * <property value="South_1" name="toPort"/> 057 * </pageflow-object> 058 * <pageflow-object id="action-call:@page:success.jsp@#@action:doLogout.do@"> 059 * <property value="116,160,160,204" name="elbowsX"/> 060 * <property value="292,292,172,172" name="elbowsY"/> 061 * <property value="East_1" name="fromPort"/> 062 * <property value="West_1" name="toPort"/> 063 * </pageflow-object> 064 * <pageflow-object id="page:success.jsp"> 065 * <property value="80" name="x"/> 066 * <property value="300" name="y"/> 067 * </pageflow-object> 068 * <pageflow-object id="external-jpf:/security/securityController.jpf"> 069 * <property value="220" name="x"/> 070 * <property value="400" name="y"/> 071 * </pageflow-object> 072 * <pageflow-object id="forward:path#success#index.jsp#@action:begin.do@"> 073 * <property value="116,240,240,364" name="elbowsX"/> 074 * <property value="52,52,52,52" name="elbowsY"/> 075 * <property value="East_1" name="fromPort"/> 076 * <property value="West_1" name="toPort"/> 077 * <property value="success" name="label"/> 078 * </pageflow-object> 079 * <pageflow-object id="forward:path#success#success.jsp#@action:save.do@"> 080 * <property value="364,240,240,116" name="elbowsX"/> 081 * <property value="292,292,292,292" name="elbowsY"/> 082 * <property value="West_1" name="fromPort"/> 083 * <property value="East_1" name="toPort"/> 084 * <property value="success" name="label"/> 085 * </pageflow-object> 086 * <pageflow-object id="return-to:@forward:return-to#curPage#previousPage#@action:loginCancel.do@@"> 087 * <property value="500" name="x"/> 088 * <property value="180" name="y"/> 089 * </pageflow-object> 090 * <pageflow-object id="forward:return-to#curPage#previousPage#@action:loginCancel.do@"> 091 * <property value="500,500,500,500" name="elbowsX"/> 092 * <property value="124,130,130,136" name="elbowsY"/> 093 * <property value="South_1" name="fromPort"/> 094 * <property value="North_1" name="toPort"/> 095 * <property value="curPage" name="label"/> 096 * </pageflow-object> 097 * <pageflow-object id="return-to:@forward:return-to#prevAction#previousAction#@action:loginSuccess.do@@"> 098 * <property value="680" name="x"/> 099 * <property value="180" name="y"/> 100 * </pageflow-object> 101 * <pageflow-object id="forward:return-to#prevAction#previousAction#@action:loginSuccess.do@"> 102 * <property value="680,680,680,680" name="elbowsX"/> 103 * <property value="124,130,130,136" name="elbowsY"/> 104 * <property value="South_1" name="fromPort"/> 105 * <property value="North_1" name="toPort"/> 106 * <property value="prevAction" name="label"/> 107 * </pageflow-object> 108 * <pageflow-object id="forward:path#success#index.jsp#@action:doLogout.do@"> 109 * <property value="276,320,320,364" name="elbowsX"/> 110 * <property value="172,172,63,63" name="elbowsY"/> 111 * <property value="East_1" name="fromPort"/> 112 * <property value="West_2" name="toPort"/> 113 * <property value="success" name="label"/> 114 * </pageflow-object> 115 * <pageflow-object id="forward:path#success#/security/securityController.jpf#@action:doLogoutSamplesHome.do@"> 116 * <property value="116,150,150,184" name="elbowsX"/> 117 * <property value="392,392,392,392" name="elbowsY"/> 118 * <property value="East_1" name="fromPort"/> 119 * <property value="West_1" name="toPort"/> 120 * <property value="success" name="label"/> 121 * </pageflow-object> 122 * <pageflow-object id="action-call:@external-jpf:/security/shoppingCartLogin/login/loginController.jpf@#@action:loginCancel.do@"> 123 * <property value="544,540,540,536" name="elbowsX"/> 124 * <property value="72,72,72,72" name="elbowsY"/> 125 * <property value="West_1" name="fromPort"/> 126 * <property value="East_1" name="toPort"/> 127 * </pageflow-object> 128 * <pageflow-object id="action-call:@external-jpf:/security/shoppingCartLogin/login/loginController.jpf@#@action:loginSuccess.do@"> 129 * <property value="616,630,630,644" name="elbowsX"/> 130 * <property value="72,72,72,72" name="elbowsY"/> 131 * <property value="East_1" name="fromPort"/> 132 * <property value="West_1" name="toPort"/> 133 * </pageflow-object> 134 * <pageflow-object id="external-jpf:/security/shoppingCartLogin/login/loginController.jpf"> 135 * <property value="580" name="x"/> 136 * <property value="80" name="y"/> 137 * </pageflow-object> 138 * </view-properties> 139 * :: 140 * 141 */ 142 public class shoppingController extends PageFlowController 143 { 144 /** 145 * @jpf:action 146 * @jpf:forward name="success" path="index.jsp" 147 */ 148 protected Forward begin() 149 { 150 return new Forward( "success" ); 151 } 152 153 /** 154 * If a non-logged in user calls this Action, a NotLoggedInException is thrown 155 * (this is because login-required is set to "true"). The exception is caught 156 * and the user is sent to the login page flow: /login/shoppingCartLogin/login/loginController.jpf 157 * (a nested page flow). 158 * 159 * If the user successfully logs in, he is returned to this Action, which executes normally. 160 * 161 * @jpf:action login-required="true" 162 * @jpf:forward name="success" path="success.jsp" 163 * @jpf:catch type="com.bea.wlw.netui.pageflow.NotLoggedInException" path="/security/shoppingCartLogin/login/loginController.jpf" 164 */ 165 protected Forward save() 166 { 167 return new Forward( "success" ); 168 } 169 170 /** 171 * @jpf:action 172 * @jpf:forward name="curPage" return-to="previousPage" 173 */ 174 protected Forward loginCancel() 175 { 176 return new Forward( "curPage" ); 177 } 178 179 /** 180 * @jpf:action 181 * @jpf:forward name="prevAction" return-to="previousAction" 182 */ 183 protected Forward loginSuccess() 184 { 185 return new Forward( "prevAction" ); 186 } 187 188 /** 189 * @jpf:action 190 * @jpf:forward name="success" path="index.jsp" 191 */ 192 protected Forward doLogout() 193 { 194 logout( false ); 195 return new Forward("success"); 196 } 197 198 /** 199 * @jpf:action 200 * @jpf:forward name="success" path="/security/securityController.jpf" 201 */ 202 protected Forward doLogoutSamplesHome() 203 { 204 logout( false ); 205 return new Forward("success"); 206 } 207 }`