How to set value in input box programmatically in adf 12c

时间:2019-03-06 11:39:47

标签: oracle oracle-adf jdeveloper oracle-fusion-middleware

I am developing application in adf 12c with 12c database. I want to set value in input box programmatically, I have tried the following code but this didn't worked.

Here is the code of input box and button on which function is called:

<af:inputText value="#{bindings.Image.inputValue}" 
  label="Picture DB" rendered="true" simple="true" 
  required="#{bindings.Image.hints.mandatory}" 
  columns="#{bindings.Image.hints.displayWidth}" 
  maximumLength="#{bindings.Image.hints.precision}" 
  shortDesc="#{bindings.Image.hints.tooltip}" id="it66" 
  binding="#{FileManageBean.dbValue}">
 <f:validator binding="#{bindings.Image.validator}"/>
</af:inputText>

<af:button text="button 1" id="b2" action="#{FileManageBean.fileUpload}"/>

Here is the code of class and function:

public class File_Upl_Dwn {
    private RichInputText dbValue;

    public File_Upl_Dwn() {
        super();
    }


    public String fileUpload() { 

      //First Method I tried, but didn't worked
      getDbValue().setValue("gogog"); 
      AdfFacesContext adffacescontext1 = AdfFacesContext.getCurrentInstance();
      adffacescontext1.addPartialTarget(dbValue); 

      //Second Method I tried, but didn't worked
      getDbValue().setValue("sfdd");
      AdfFacesContext.getCurrentInstance().addPartialTarget(getDbValue());
      return "ok";
    }

    public void setDbValue(RichInputText dbValue) {
        this.dbValue = dbValue;
    }

    public RichInputText getDbValue() {
        return dbValue;
    }
}

Any help regarding how to enter value in input box programmatically will be really appreciated.

1 个答案:

答案 0 :(得分:0)

尝试在按钮中添加 partialSubmit =“ true” ,并在inputText partialTriggers =“ b2” 中引用按钮

<af:inputText value="#{bindings.Image.inputValue}" 
  label="Picture DB" rendered="true" simple="true"  
  required="#{bindings.Image.hints.mandatory}" 
  columns="#{bindings.Image.hints.displayWidth}" 
  maximumLength="#{bindings.Image.hints.precision}"  partialTriggers="b2"
  shortDesc="#{bindings.Image.hints.tooltip}" id="it66" 
  binding="#{FileManageBean.dbValue}">
 <f:validator binding="#{bindings.Image.validator}"/>
</af:inputText>


<af:button  text="button 1" id="b2" action="#{FileManageBean.fileUpload}" partialSubmit="true"/>