0

I'm starting with Oracle ADF and JDeveloper. I'm doing some basic tutorials first.

From the HR database schema, I'm trying this exercise: create a new location, but in CountryId attribute, show all countries list.

This is more user-friendly, so the user can select Italy instead of typing IT .

For this, I'm doing this steps:

In Locations view , choose CountryId attribute and create a LOV. This one must read from CountriesView1, with value CountryId attribute, and show CountryName attribute.

  1. Drop LocationsView1 in a page and select ADF Form.
  2. Select CountryId as a combo box.
  3. Drop Create operation from LocationsView1 as a button.
  4. Drop Commit operation as a button.

When running this page, I see all country names, but when I choose one of them, it does not show me it as selected, and, when commit the new data, CountryId is inserting with null value.

Obviously, I'm doing something in a wrong way. How can I do this simple form, with CountryId as a list?

Can anyone help me, please?

Thanks in advance. Best regards

EDIT: code of 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>
4

1 回答 1

0

嗯,我做到了!步骤是:

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

好吧,最后,列出了 COUNTRIES 表中的所有国家,并将数据插入到 LOCATIONS 表中。

我希望这会有用。问候

于 2013-07-22T10:17:29.157 回答