3 Replies Latest reply: Nov 19, 2012 12:45 AM by Timo Hahn RSS

    get textfield value in corn job

    868692
      I have corn job which start even if I didn't open the browser
      in this job i need to get value from data base
      I tried many ways but i failed :(
      how can I do that ?

      Edited by: belal on Nov 18, 2012 6:22 AM
        • 1. Re: get textfield value in corn job
          Timo Hahn
          Before we mention all possible solution you already tried, can you please tell us what you have tried?
          And please mention your jdev version!


          Timo
          • 2. Re: get textfield value in corn job
            868692
            I am using jdeveloper 11.1.2

            I have two text field which presents two fields in data base
            I want to get the value of these fields in my code
            so I tried to bind these fields to java bean but when I get the value of them I find it null

            so I tried to get value from db directly just like that

            FacesContext context = FacesContext.getCurrentInstance();
            Application app = context.getApplication();
            ValueBinding bind = app.createValueBinding("#{data." + name + ".dataProvider}");
            ApplicationModule am = (ApplicationModule)bind.getValue(context);
            try {
            ViewObjectImpl vo = (ViewObjectImpl) am.findViewObject(voName);
            vo.executeQuery();
            Row voRow =vo.first();
            return voRow;
            } catch (Exception ex) {
            return null;
            }

            but I get the context as null
            • 3. Re: get textfield value in corn job
              Timo Hahn
              Where is the connection to the cron job? A cron job normally don't have an ui as it runs unattended.
              A job needs to connect to the db first before you can get values.

              If you like to update the fields in the ui you can use an af:poll component.

              Timo