1 Reply Latest reply: Nov 21, 2003 12:33 PM by 55663 RSS

    Data Binding in ADF UIX example trouble

      Two related questions:
      From the help example 3. Data Binding in ADF UIX example trouble in JDeveloper on UIX. If this worked I was going to run a small java class that captures the login and passes it as a messagebox with a Welcome login name on the first page, but I can't get past the example and path problems.

      From the example..."

      package yourpackage;
      import java.util.Date;

      public class CurrentDateBean
      public CurrentDateBean() { }

      public String getTime()
      return (new Date()).toString();

      Now, we want to change the page so it uses getTime(). We need to do three things: Tell UIX to data bind the text attribute. Add a <dataScope> to the page to provide data to the content. Write a small "data provider" in Java that can access the bean. First, we'll data bind "text": <text xmlns="http://xmlns.oracle.com/uix/ui"
      text="${uix.data.currentDate.time}"/>The example has one small change. The value is changed to ${uix.data.currentDate.time}, which is an expression that defines the data. This is shorthand for "get the time property from currentDate." If you tried running this example, you'd see nothing. That iss because we haven't given currentDate to the page, so the databinding failed, and the "text" is left to null. We do this by adding <dataScope> to the page: <dataScope xmlns="http://xmlns.oracle.com/uix/ui">

      Q#1?? Trying to follow the demo. The method class and method name do not seem to match the names in the above class from the demo. Am I missing a point here, please help.

      <data name="currentDate">
      <method class="yourpackage.DataDemo" method="getCurrentDate"/>
      <text text="${uix.data.currentDate.time}"/>

      Q#2?? When I try and apply the demo class to my home.uix XML file with
      "<?xml version = '1.0' encoding = 'windows-1252'?>
      <page xmlns="http://xmlns.oracle.com/uix/controller"
      xmlns:html="http://www.w3.org/TR/REC-html40" expressionLanguage="el">
      <dataScope xmlns="http://xmlns.oracle.com/uix/ui">
      <!-- start Add DataProviders (<data> elements) here -->
      <data name="currentDate">
      <method class="us.mn.state.dot.apptrack.security.CurrentDateBean" method="getTime()"/>
      <!-- end Add DataProviders (<data> elements) here -->
      <text text="${uix.data.currentDate.time}"/>
      I get the following, and I don't know how to make the UIX XML accept the correct path, please help:

      �file:/C:/JDeveloper905p/jdev/mywork/ProjTrack/AppTrack/ViewController/public_html/home.uix: Parsing error, line 12, column 97: Could not find class us.mn.state.dot.apptrack.security.CurrentDateBean
        • 1. Re: Data Binding in ADF UIX example trouble
          for question 1 the name of the class CurrentDateBean
          actually has nothing to do with the el expression
          uix.data.currentDate.time. The currentDate part of the
          el expression is coming from the method data provider part
          of your page:
          <data name="currentDate">
          <method class="yourpackage.DataDemo"
          so if you changed the name of the data provider to "foo":
          <data name="foo">
          <method class="yourpackage.DataDemo"

          your el would look like this:
          by the way the uix.data part tells UIX to look for
          a <data> element define in the <provider> section of
          your dataScope.

          For question #2, do you have the java file
          us.mn.state.dot.apptrack.security.CurrentDateBean on
          your classpath and is it compiled? You will get that
          warning if it is not on your classpath.

          Also you are incorrectly interpreting the example. What
          you are doing is trying to reference the actual bean
          object and its getTime() method. What you want to do
          is write a method data provider that returns your
          CurrentDataBean. so uix.data.currentDate would return
          a CurrentDateBean instance object. the .time part of the
          el expression would tell UIX to look for a method named
          getTime() and use that value.

          let me know if you have any more questions.