OAF中从弹性域获取值的明细页面

在做项目时,有时会碰到一个页面跳转到另外一个明细页面,而且这个明细页面全部由一些弹性域字段组成的,下面是使用co代码动态创建出来的符合这种需求的明细页面,并且可以动态创建多个表格

/*===========================================================================+ | Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA | | All rights reserved. | +===========================================================================+ | HISTORY | +===========================================================================*/ package cux.oracle.apps.pa.statusreport.webui; import oracle.apps.fnd.common.VersionInfo; import oracle.apps.fnd.framework.webui.OAControllerImpl; import oracle.apps.fnd.framework.webui.OAPageContext; import oracle.apps.fnd.framework.webui.beans.OAWebBean; import oracle.apps.fnd.framework.OAApplicationModule; import oracle.apps.fnd.framework.OAViewObject; import oracle.apps.fnd.framework.server.OADBTransaction; import oracle.apps.fnd.framework.webui.beans.table.OATableBean; import oracle.apps.fnd.framework.webui.beans.OADescriptiveFlexBean; import oracle.apps.fnd.framework.webui.beans.layout.OASpacerBean; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; /** * Controller for ... */ public class CuxReportDetailCO extends OAControllerImpl { public static final String RCS_ID = "$Header$"; public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion(RCS_ID, "%packagename%"); /** * Layout and page setup logic for a region. * @param pageContext the current OA page context * @param webBean the web bean corresponding to the region */ public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); String versionId = pageContext.getParameter("versionId"); String pageId = pageContext.getParameter("pageId"); renderDescFlex(pageContext, webBean, versionId, pageId); } /** * Procedure to handle form submissions for form elements in * a region. * @param pageContext the current OA page context * @param webBean the web bean corresponding to the region */ public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); } private void renderDescFlex(OAPageContext pageContext, OAWebBean webBean, String versionId, String pageId) { int flexCount = 1; OAApplicationModule am = pageContext.getApplicationModule(webBean); OADBTransaction txn = am.getOADBTransaction(); PreparedStatement ps = null; ResultSet rs = null; String sql = "SELECT pplr.region_source_code,ffc.descriptive_flex_context_name" + " FROM pa_page_layout_regions pplr," + " fnd_descr_flex_contexts_vl ffc" + " WHERE pplr.region_source_type = 'DFF'" + " AND pplr.region_source_code=ffc.descriptive_flex_context_code" + " AND ffc.descriptive_flexfield_name = 'PA_STATUS_REPORT_DESC_FLEX'" + " AND ffc.application_id = 275" + " AND page_id = :1" + " ORDER BY display_order"; try { ps = txn.createPreparedStatement(sql, 1); ps.setString(1, pageId); rs = ps.executeQuery(); while (rs.next()) { String regionSourceCode = rs.getString(1); String flexContextName = rs.getString(2); String voName = "DffVO" + flexCount; OAViewObject vo = (OAViewObject)am.findViewObject(voName); if (vo == null) { vo = (OAViewObject)am.createViewObject(voName, "cux.oracle.apps.pa.statusreport.server.ReportDetailVO"); } vo.setWhereClause(null); vo.setWhereClauseParams(null); vo.setWhereClause(" version_id=:1 AND region_code=:2"); vo.setWhereClauseParam(0, versionId); vo.setWhereClauseParam(1, regionSourceCode); vo.executeQuery(); int rowCount = vo.getRowCount(); OATableBean tableBean = (OATableBean)createWebBean(pageContext, TABLE_BEAN, null, "ResultTable" + flexCount); tableBean.setText(flexContextName); tableBean.setWidth("100%"); webBean.addIndexedChild(tableBean); tableBean.setNumberOfRowsDisplayed(rowCount); OADescriptiveFlexBean descFlex = (OADescriptiveFlexBean)createWebBean(pageContext, DESCRIPTIVE_FLEX_BEAN, null, "DescFF" + flexCount); descFlex.setAttributeValue(OAWebBeanConstants.VIEW_USAGE_NAME, voName); descFlex.setAttributeValue(OAWebBeanConstants.FLEXFIELD_APPLICATION_SHORT_NAME, "PA"); descFlex.setAttributeValue(OAWebBeanConstants.REGION_APPLICATION_ID, new Integer(275)); descFlex.setAttributeValue(OAWebBeanConstants.FLEXFIELD_NAME, "PA_STATUS_REPORT_DESC_FLEX"); descFlex.setFlexContextCode(pageContext, regionSourceCode); descFlex.setContextListRendered(false); descFlex.setReadOnly(true); tableBean.addIndexedChild(descFlex); OASpacerBean spacerBean = (OASpacerBean)createWebBean(pageContext, SPACER_BEAN, null, "SpaceBean" + flexCount); spacerBean.setHeight("15"); webBean.addIndexedChild(spacerBean); flexCount++; } rs.close(); ps.close(); } catch (SQLException se) { } } }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值