我在使用了下载功能之后,再往页面添加行或进行保存,页面老是报浏览器后退的异常。
猜测是因为我的下载按钮使用的submitButton,它隐式的包含了一个submit动作,且我在代码中有一个Commit动作,而下载完成之后有一个
response.getOutputStream().flush();
response.getOutputStream().close();
操作,导致页面失效。
解决方式:
将submitButton改为button,再增加firePartialAction的事件即可。
另:如果是标准的页面,需要添加一个button按钮,且为其添加事件的代码如下。
//预览审核报告 OACellFormatBean createPreviewCellBean =(OACellFormatBean)this.createWebBean(pageContext , OAWebBeanConstants.CELL_FORMAT_BEAN , null , null); OAButtonBean previewPDFBean = (OAButtonBean)createWebBean(pageContext , OAWebBeanConstants.BUTTON_BEAN , null , "CuxPreviewPDFEvent"); previewPDFBean.setID("CuxPreviewPDFBtn"); previewPDFBean.setName("CuxPreviewPDFBtn"); String previewPDF = pageContext.getMessage("CUX" , "CUX_PREVIEW_PDF_FILE" , null); previewPDFBean.setLabel(previewPDF); previewPDFBean.setText(previewPDF); Hashtable apprHashTable = new Hashtable(1); //此事件会隐式的包含submit动作。 //apprHashTable.put("CuxSuppCateMappingId" , // new OADataBoundValueViewObject(CuxViewApprHisBean , "SuppItemCateMappingId" , "NewSuppReqSearchVO")); //previewPDFBean.setFireActionForSubmit("CuxPreviewPDFEvent", null, apprHashTable, true, true); //此事件等价于在Button上设置了firePartialAction事件,且parameters中的key,value分别为param_AucHeaderId,{$AuctionHeaderId} FirePartialAction previewFirePartialAction = new FirePartialAction("CuxPreviewPDFEvent");Parameter[] params = new Parameter[4]; params[0] = new Parameter(); params[0].setValueBinding(new OADataBoundValueFireActionURL(attrBidValueBean , "{$AuctionHeaderId}")); params[0].setKey("param_AucHeaderId"); previewPDFBean.setAttributeValue(OAWebBeanConstants.PRIMARY_CLIENT_ACTION_ATTR,previewFirePartialAction); createPreviewCellBean.addIndexedChild(previewPDFBean); OARowLayoutBean btnRowBean =(OARowLayoutBean)webBean.findChildRecursive("ButtonBarRow"); btnRowBean.addIndexedChild(createPreviewCellBean);
添加图片按钮事件
OAImageBean CuxViewApprHisBean = (OAImageBean)createWebBean(pageContext,OAWebBeanConstants.IMAGE_BEAN,null,null); CuxViewApprHisBean.setID("CuxViewApprHistory"); String apprHierarchy = pageContext.getMessage("CUX" , "CUX_SUPP_INQURE_APP_HIS" , null); CuxViewApprHisBean.setLabel(apprHierarchy); CuxViewApprHisBean.setSource(OAWebBeanConstants.APPS_MEDIA_DIRECTORY +"duplicate_enabled.gif"); Hashtable apprHashTable = new Hashtable(1); apprHashTable.put("CuxSuppCateMappingId" , new OADataBoundValueViewObject(CuxViewApprHisBean , "SuppItemCateMappingId" , "NewSuppReqSearchVO")); CuxViewApprHisBean.setFireActionForSubmit("CuxApproveHistEvent" , null , apprHashTable , true); ResultRNBean.addIndexedChild(11 , CuxViewApprHisBean);
Table添加列
OATableBean ResultRNBean = (OATableBean)webBean.findChildRecursive("RegTableRN"); OAMessageStyledTextBean phoneBean = (OAMessageStyledTextBean)createWebBean(pageContext, OAMessageStyledTextBean.MESSAGE_STYLED_TEXT_BEAN, null, "PhoneNumber"); phoneBean.setViewUsageName("NewSuppReqSearchVO"); //此列绑定的VO phoneBean.setViewAttributeName("PhoneNumber"); //此列绑定的VO中的字段 phoneBean.setLabel("联系电话"); //此列需要显示的题头 ResultRNBean.addIndexedChild(9, phoneBean);
Table添加Switcher列
OASwitcherBean reviewSwitcherRN = (OASwitcherBean)createWebBean(pageContext, "/cux/oracle/apps/pos/onboard/webui/CuxSuppReqReviewSwitcherRN", "reviewSwitcherRN", true); if (ResultRNBean != null) { ResultRNBean.addIndexedChild(12, reviewSwitcherRN); }
标准删除按钮添加事件
OAImageBean DeleteBean = (OAImageBean)webBean.findChildRecursive("Delete"); Hashtable deleteHashTable = new Hashtable(2); deleteHashTable.put("mappingId", new OADataBoundValueViewObject(DeleteBean, "MappingId", "NewSuppReqSearchVO")); deleteHashTable.put("RegistrationStatus", new OADataBoundValueViewObject(DeleteBean, "RegistrationStatus", "NewSuppReqSearchVO")); DeleteBean.setFireActionForSubmit("CuxDelete", null, deleteHashTable, true);