ADF是在OracleAS产品线中的一个通用的应用开发框架,而OAF是OracleEBS中的技术组
件,是EBS中所有网页功能采用的应用框架。
通常ADF会采用最近肆大轿的技术,如果你做J2EE的开发的话,在应用采用ADF。
如果仿旅你需要在OracleEBS上扩展和开发新的功能,则需要采用OAF。
ADF和OAF在很多技术上是相似的,比如OAF中采用BC4J的业务层组件,而在ADF中BC4J(
ADFBC)仅仅是其中的一个选项。
用以下的代码可以实现,但是有一点不足,就是当数据量比较多的时候,无法按照指定的行数进行分页显示。先尘纯磨在页面裤搏上创建一个advancedTable,名字叫“region5”,即可。
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean)
final String CHILD_DATA_LIST = "childDataList"
final String TEXT = "text"
int COLUMN_COUNT = 0
// write your Personalization SQL in here.
StringBuffer sbfSQL = new StringBuffer(200)
//派斗 set title in the advancedTable
sbfSQL.append("SELECT '名' user_name, 'ID' user_id, '开始日' FROM dual \r\n")
sbfSQL.append("UNION ALL \r\n")
sbfSQL.append("SELECT fu.user_name, to_char(fu.user_id), to_char(fu.start_date) FROM fnd_user fu")
ResultSet rs = null
Statement s = null
Connection con = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection()
try
{
s = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE)
rs = s.executeQuery(sbfSQL.toString())
ResultSetMetaData rsmd = rs.getMetaData()
COLUMN_COUNT = rsmd.getColumnCount()
rs.last()
int intRowCount = rs.getRow()
rs.first()
// find the advancedTable
OAAdvancedTableBean tableBean = (OAAdvancedTableBean)webBean.findChildRecursive("region5")
tableBean.setViewUsageName("")
for (int i = 1i <= COLUMN_COUNTi++)
{
// create a column
OAColumnBean cb = (OAColumnBean)createWebBean(pageContext, COLUMN_BEAN, null, null)
tableBean.addIndexedChild(cb)
// create MessageStyledText
OAMessageStyledTextBean mst = (OAMessageStyledTextBean)createWebBean(pageContext, MESSAGE_STYLED_TEXT_BEAN, null, null)
mst.setTextBinding(TEXT + i)
cb.addIndexedChild(mst)
// create title
OASortableHeaderBean shb = (OASortableHeaderBean)createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, null)
shb.setPrompt(rs.getString(i))
cb.setColumnHeader(shb)
if (i != 1)
{
UINodeList colList = new DataObjectListNodeList(mst, new DataBoundValue(CHILD_DATA_LIST + i))
cb.setIndexedNodeList(colList)
}
}
// get row count
DictionaryData rowData[] = new DictionaryData[intRowCount - 1]
int intRowLoop = 2
// loop row
while (rs.next())
{
// setting 1 column cell value
rowData[intRowLoop - 2] = new DictionaryData(TEXT + "1", rs.getString(1))
// setting 2 to N column cell value
DictionaryData otherColumn[] = new DictionaryData[COLUMN_COUNT]
// loop column
for (int j = 2j <= COLUMN_COUNTj++)
{
otherColumn[j - 2] = new DictionaryData(TEXT + j, rs.getString(j))
rowData[intRowLoop - 2].put(CHILD_DATA_LIST + j , new ArrayDataSet(otherColumn))
}
intRowLoop++
}
tableBean.setTableData(new ArrayDataSet(rowData))
}
catch (SQLException se)
{
se.printStackTrace()
}
finally
{
if (s != null)
{
try
{
s.close()
}
catch (SQLException se)
{
se.printStackTrace()
}
}
if (rs != null)
{
try
{
rs.close()
}
catch (SQLException se)
{
se.printStackTrace()
}
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)