ADF使用组合框创建表单

时间:2013-07-22 07:17:26

标签: customization user-input oracle-adf lov

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

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

这更加用户友好,因此用户可以选择意大利而不是输入IT。

为此,我正在做这个步骤:

位置视图中,选择 CountryId 属性并创建LOV。这个必须从 CountriesView1 读取,其值为 CountryId ,并显示 CountryName 属性。

  1. 在页面中删除 LocationsView1 ,然后选择ADF表单。
  2. 选择 CountryId 作为组合框。
  3. LocationsView1 中删除创建操作作为按钮。
  4. 提交操作作为按钮删除。
  5. 运行此页面时,我会看到所有国家/地区名称,但是当我选择其中一个时,它不会将其显示为已选中,并且在提交新数据时,CountryId将插入空值。

    显然,我正在以错误的方式做事。 如何使用CountryId作为列表来执行此简单表单?

    有人可以帮助我吗?

    提前致谢。最好的问候

    编辑 dataEntry.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>
    

1 个答案:

答案 0 :(得分:0)

好吧,我做到了! 步骤是:

  1. 在页面中删除 LocationsView1 并选择 ADF表格...
  2. 从LocationsView1中删除创建操作作为按钮。
  3. 提交操作作为按钮
  4. 删除
  5. 删除 CountryId 输入文字
  6. Re )从 LocationsView1 中删除 CountryId 。当JDeveloper要求时,选择选择一个 选择...
  7. 在“绑定”部分,选择 CountryId 并编辑(笔图标)
  8. 选择动态列表单选按钮和 CountriesView1 ListDataSource组合
  9. 使用 CountryId 列表属性将数据值中的 CountryId 匹配。在下面的部分中选择 CountryName
  10. 最后,列出了COUNTRIES表中的所有国家/地区,并将数据插入LOCATIONS表中。

    我希望这会有用。 此致

相关问题