【问题标题】:ADF create form with combo boxADF 使用组合框创建表单
【发布时间】:2013-07-22 07:17:25
【问题描述】:

我从 Oracle ADF 和 JDeveloper 开始。我先做一些基础教程。

从 HR 数据库架构中,我正在尝试这个练习:创建一个新位置,但在 CountryId 属性中,显示所有国家/地区列表。

这样对用户更友好,因此用户可以选择 Italy 而不是输入 IT 。

为此,我正在执行以下步骤:

Locations 视图中,选择 CountryId 属性并创建一个 LOV。这个必须从 CountriesView1 中读取,带有值 CountryId 属性,并显示 CountryName 属性。

  1. LocationsView1 拖放到页面中并选择 ADF 表单。
  2. 选择 CountryId 作为组合框。
  3. LocationsView1 中删除 Create 操作作为按钮。
  4. 提交操作作为按钮删除。

运行此页面时,我会看到所有国家/地区名称,但是当我选择其中一个时,它不会显示为选中状态,并且在提交新数据时,CountryId 会插入空值。

显然,我做错了事。 如何使用 CountryId 作为列表来完成这个简单的表单?

有人可以帮帮我吗?

提前致谢。最好的问候

EDITdataEntry.jspx

的代码
    <?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <jsp:directive.page contentType="text/html;charset=UTF-8"/>
  <f:view>
    <af:document id="d1" binding="#{backingBeanScope.backing_dataEntry.d1}">
      <af:messages binding="#{backingBeanScope.backing_dataEntry.m1}" id="m1"/>
      <af:form id="f1" binding="#{backingBeanScope.backing_dataEntry.f1}">
        <af:panelStretchLayout id="psl1"
                               binding="#{backingBeanScope.backing_dataEntry.psl1}">
          <f:facet name="center">
            <af:panelFormLayout binding="#{backingBeanScope.backing_dataEntry.pfl1}"
                                id="pfl1">
              <af:panelFormLayout binding="#{backingBeanScope.backing_dataEntry.pfl2}"
                                  id="pfl2">
                <af:inputText value="#{bindings.LocationId.inputValue}"
                              label="#{bindings.LocationId.hints.label}"
                              required="#{bindings.LocationId.hints.mandatory}"
                              columns="#{bindings.LocationId.hints.displayWidth}"
                              maximumLength="#{bindings.LocationId.hints.precision}"
                              shortDesc="#{bindings.LocationId.hints.tooltip}"
                              binding="#{backingBeanScope.backing_dataEntry.it1}"
                              id="it1">
                  <f:validator binding="#{bindings.LocationId.validator}"/>
                  <af:convertNumber groupingUsed="false"
                                    pattern="#{bindings.LocationId.format}"/>
                </af:inputText>
                <af:inputText value="#{bindings.StreetAddress.inputValue}"
                              label="#{bindings.StreetAddress.hints.label}"
                              required="#{bindings.StreetAddress.hints.mandatory}"
                              columns="#{bindings.StreetAddress.hints.displayWidth}"
                              maximumLength="#{bindings.StreetAddress.hints.precision}"
                              shortDesc="#{bindings.StreetAddress.hints.tooltip}"
                              binding="#{backingBeanScope.backing_dataEntry.it2}"
                              id="it2">
                  <f:validator binding="#{bindings.StreetAddress.validator}"/>
                </af:inputText>
                <af:inputText value="#{bindings.PostalCode.inputValue}"
                              label="#{bindings.PostalCode.hints.label}"
                              required="#{bindings.PostalCode.hints.mandatory}"
                              columns="#{bindings.PostalCode.hints.displayWidth}"
                              maximumLength="#{bindings.PostalCode.hints.precision}"
                              shortDesc="#{bindings.PostalCode.hints.tooltip}"
                              binding="#{backingBeanScope.backing_dataEntry.it3}"
                              id="it3">
                  <f:validator binding="#{bindings.PostalCode.validator}"/>
                </af:inputText>
                <af:inputText value="#{bindings.City.inputValue}"
                              label="#{bindings.City.hints.label}"
                              required="#{bindings.City.hints.mandatory}"
                              columns="#{bindings.City.hints.displayWidth}"
                              maximumLength="#{bindings.City.hints.precision}"
                              shortDesc="#{bindings.City.hints.tooltip}"
                              binding="#{backingBeanScope.backing_dataEntry.it4}"
                              id="it4">
                  <f:validator binding="#{bindings.City.validator}"/>
                </af:inputText>
                <af:inputText value="#{bindings.StateProvince.inputValue}"
                              label="#{bindings.StateProvince.hints.label}"
                              required="#{bindings.StateProvince.hints.mandatory}"
                              columns="#{bindings.StateProvince.hints.displayWidth}"
                              maximumLength="#{bindings.StateProvince.hints.precision}"
                              shortDesc="#{bindings.StateProvince.hints.tooltip}"
                              binding="#{backingBeanScope.backing_dataEntry.it5}"
                              id="it5">
                  <f:validator binding="#{bindings.StateProvince.validator}"/>
                </af:inputText>
                <af:inputListOfValues id="countryIdId"
                                      popupTitle="Search and Select: #{bindings.CountryId.hints.label}"
                                      value="#{bindings.CountryId.inputValue}"
                                      label="#{bindings.CountryId.hints.label}"
                                      model="#{bindings.CountryId.listOfValuesModel}"
                                      required="#{bindings.CountryId.hints.mandatory}"
                                      columns="#{bindings.CountryId.hints.displayWidth}"
                                      shortDesc="#{bindings.CountryId.hints.tooltip}"
                                      binding="#{backingBeanScope.backing_dataEntry.countryIdId}">
                  <f:validator binding="#{bindings.CountryId.validator}"/>
                </af:inputListOfValues>
                <af:commandButton actionListener="#{bindings.Create.execute}"
                                  text="Create"
                                  disabled="#{!bindings.Create.enabled}"
                                  binding="#{backingBeanScope.backing_dataEntry.cb1}"
                                  id="cb1"/>
                <af:commandButton actionListener="#{bindings.Commit.execute}"
                                  text="Commit"
                                  disabled="#{!bindings.Commit.enabled}"
                                  binding="#{backingBeanScope.backing_dataEntry.cb2}"
                                  id="cb2"/>
              </af:panelFormLayout>
            </af:panelFormLayout>
            <!-- id="af_one_column_stretched"   -->
          </f:facet>
        </af:panelStretchLayout>
      </af:form>
    </af:document>
  </f:view>
  <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_dataEntry-->
</jsp:root>

【问题讨论】:

  • 您能否展示一下包含组合框和按钮的 JSP 的代码?
  • @MohamedSanaulla,感谢您的关注。最后我已经解决了我的问题,我正在写答案

标签: customization user-input oracle-adf lov


【解决方案1】:

嗯,我做到了! 步骤是:

  1. LocationsView1 拖放到页面中并选择 ADF 表单...
  2. 从 LocationsView1 中删除 Create 操作作为按钮。
  3. 提交操作作为按钮删除
  4. 删除CountryId输入文本
  5. (Re)从 LocationsView1 中删除 CountryId。当 JDeveloper 询问时,选择 Select One 选择...
  6. 在 Bindings 部分,选择 CountryId 并编辑(钢笔图标)
  7. 选择动态列表单选按钮和CountriesView1 ListDataSource 组合
  8. 将数据值中的 CountryIdCountryId 列表属性相匹配。在下面的部分中选择 CountryName

嗯,最后,COUNTRIES 表中的所有国家都被列出,数据被插入到 LOCATIONS 表中。

我希望这会很有用。 问候

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-16
    • 2013-04-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多