001 package tagSamples.netui.checkBoxOption;
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
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:/tagSamples/netui/checkBoxOption/CheckBoxOptionController.jpf"/>
012 * <pageflow-object id="action:begin.do#tagSamples.netui.checkBoxOption.CheckBoxOptionController.ProcessDataForm">
013 * <property value="60" name="x"/>
014 * <property value="100" name="y"/>
015 * </pageflow-object>
016 * <pageflow-object id="action:processData.do#tagSamples.netui.checkBoxOption.CheckBoxOptionController.ProcessDataForm">
017 * <property value="280" name="x"/>
018 * <property value="100" name="y"/>
019 * </pageflow-object>
020 * <pageflow-object id="action-call:@page:index.jsp@#@action:processData.do#tagSamples.netui.checkBoxOption.CheckBoxOptionController.ProcessDataForm@">
021 * <property value="216,230,230,244" name="elbowsX"/>
022 * <property value="92,92,92,92" name="elbowsY"/>
023 * <property value="East_1" name="fromPort"/>
024 * <property value="West_1" name="toPort"/>
025 * </pageflow-object>
026 * <pageflow-object id="page:index.jsp">
027 * <property value="180" name="x"/>
028 * <property value="100" name="y"/>
029 * </pageflow-object>
030 * <pageflow-object id="page:showData.jsp">
031 * <property value="400" name="x"/>
032 * <property value="100" name="y"/>
033 * </pageflow-object>
034 * <pageflow-object id="forward:path#success#index.jsp#@action:begin.do#tagSamples.netui.checkBoxOption.CheckBoxOptionController.ProcessDataForm@">
035 * <property value="96,120,120,144" name="elbowsX"/>
036 * <property value="92,92,92,92" name="elbowsY"/>
037 * <property value="East_1" name="fromPort"/>
038 * <property value="West_1" name="toPort"/>
039 * <property value="success" name="label"/>
040 * </pageflow-object>
041 * <pageflow-object id="forward:path#success#showData.jsp#@action:processData.do#tagSamples.netui.checkBoxOption.CheckBoxOptionController.ProcessDataForm@">
042 * <property value="316,340,340,364" name="elbowsX"/>
043 * <property value="92,92,92,92" name="elbowsY"/>
044 * <property value="East_1" name="fromPort"/>
045 * <property value="West_1" name="toPort"/>
046 * <property value="success" name="label"/>
047 * </pageflow-object>
048 * <pageflow-object id="formbeanprop:tagSamples.netui.checkBoxOption.CheckBoxOptionController.ProcessDataForm#data#java.lang.String[]"/>
049 * <pageflow-object id="formbean:tagSamples.netui.checkBoxOption.CheckBoxOptionController.ProcessDataForm"/>
050 * </view-properties>
051 * ::
052 */
053 public class CheckBoxOptionController extends PageFlowController
054 {
055 /**
056 * @jpf:action
057 * @jpf:forward name="success" path="index.jsp"
058 */
059 protected Forward begin(ProcessDataForm form)
060 {
061 return new Forward("success");
062 }
063
064 /**
065 * @jpf:action
066 * @jpf:forward name="success" path="showData.jsp"
067 */
068 protected Forward processData(ProcessDataForm form)
069 {
070 String wantsCDOffers = "false";
071 String wantsDVDOffers = "false";
072
073 for(int i = 0; i<form.getData().length; i++)
074 {
075 if(form.getData()[i].equals("CDtrue"))
076 wantsCDOffers = "true";
077 if(form.getData()[i].equals("DVDtrue"))
078 wantsDVDOffers = "true";
079 }
080
081 // Place the submitted data on the request Object.
082 getRequest().setAttribute("wantsCDOffers", wantsCDOffers);
083 getRequest().setAttribute("wantsDVDOffers", wantsDVDOffers);
084
085 return new Forward("success");
086 }
087
088 /**
089 * FormData get and set methods may be overwritten by the Form Bean editor.
090 */
091 public static class ProcessDataForm extends FormData
092 {
093 private String[] data;
094
095 public void setData(String[] data)
096 {
097 this.data = data;
098 }
099
100 public String[] getData()
101 {
102 return this.data;
103 }
104 }
105 }
|