Create table with ADF query panel

本文详细介绍如何利用ADF查询面板创建简单表格。通过创建包含Id、Name、PurchasingDate和Owner属性的BooksVO,并设置视图准则BooksViewCriteria,实现基本搜索、高级搜索及QBE功能。文章展示了创建过程及查询工作原理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

This article gives a step-by-step introduction on how to create a simple table with ADF query panel.

 

We have a BooksVO with attributes Id, Name, PurchadsingDate and Owner.

Create a view criteria BooksViewCriteria with items Id, Name, PurchadsingDate and Owner, in which Id and Name are selectively required.

Create a new JSP page Page6.jsf on which we will create the table:

Expand the BooksAppModuleDataControl in Data Controls, drag the view criteria BooksViewCriteria and drop into the jsf file.

In the Create tab, select Query → ADF Query Panel With Table.

In Create Table, check Enable Sorting and Enable Filtering. Click on OK.

After creating the table successfully, we can see the design of the page. There are a query panel and a table on the page.

Drag Page6 to adfc-config.xml. Right click on the blank and select Run. 

 

After it runs successfully, click on the target URL and open the page.

 

We can see from the page that BooksViewCriteria is set as the default Saved Search.

Since  Id and Name are set as selectively required in the view criteria, they are marked as "At least one is required."

Test basic search:

Give the Id 1 and click on search, the table shows the book of Id 1.

 

Test Advanced Search:

Navigate to Advanced Search and we can find there are more operators to choose.

 

Test QBE:

Type the keyword you want to filter in the input text box and enter to get the filter results.

 

How the query works?

Navigate to the Bindings of Page6.jsf we can find  BooksViewCriteraQuery is created as a search region automatically and linked to the VO when we create the table using the view BooksViewCriteria.

Code snippet of <af: query> and <af: table>:

<af:panelHeader text="Books" id="ph1">

    <af:query id="qryId1" headerText="Search" disclosed="true"

              value="#{bindings.BooksViewCriteriaQuery.queryDescriptor}"

              model="#{bindings.BooksViewCriteriaQuery.queryModel}"

              queryListener="#{bindings.BooksViewCriteriaQuery.processQuery}"

              queryOperationListener="#{bindings.BooksViewCriteriaQuery.processQueryOperation}"

              resultComponentId="::resId1"/>

</af:panelHeader>

<af:table value="#{bindings.BooksView1.collectionModel}" var="row"

          rows="#{bindings.BooksView1.rangeSize}"

          emptyText="#{bindings.BooksView1.viewable ? 'No data to display.' : 'Access Denied.'}"

          rowBandingInterval="0"

          selectedRowKeys="#{bindings.BooksView1.collectionModel.selectedRow}"

          selectionListener="#{bindings.BooksView1.collectionModel.makeCurrent}"

          rowSelection="single" fetchSize="#{bindings.BooksView1.rangeSize}"

          filterModel="#{bindings.BooksViewCriteriaQuery.queryDescriptor}"

          filterVisible="true"

          queryListener="#{bindings.BooksViewCriteriaQuery.processQuery}"

          varStatus="vs" id="resId1">

    ...

</af:table>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值