This discussion is archived
3 Replies Latest reply: Nov 18, 2012 10:45 PM by Timo Hahn RSS

get textfield value in corn job

868692 Newbie
Currently Being Moderated
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 Oracle ACE
    Currently Being Moderated
    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 Newbie
    Currently Being Moderated
    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 Oracle ACE
    Currently Being Moderated
    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

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points