2012-04-03 4 views
1

단추 ActionListener에서 데이터 제어 작업 (CreateInsert 및 Delete)을 실행하려고합니다. Data Control 메뉴에서 데이터 컨트롤 단추를 삽입 할 수 있다는 것을 알고 있지만 여러 가지 이유로이 방법으로 수행해야합니다. 즉, 추가 런타임 검사를 수행해야하는 중요한 작업입니다. ADF 코드에서 수동으로 작업 호출

는 다음 코드 발견 :

 OperationBinding operation = bindings.getOperationBinding("operation_name"); 
     operation.getParamsMap().put("parameter_name", parameterValue); 
     operation.execute(); 

을하지만 자신을 위해 사용할 변수 모른다. 우선, 나는 어떤 바인딩을 사용해야하는지 모른다. 그런 다음 작업 이름을 알고있는 한 CreateInsert로, 다음 단추 인 CreateInsert1에 대해 작업 이름을 지정해야합니다. 그게 UIBinding에 사용 된 것입니다 (제거 할 것입니다).

조작을 사용하려는 데이터 컨트롤은 'ARNG1'입니다.

간단히 말해,이 데이터 컨트롤의 CreateInsert 작업을 수동으로 호출하는 방법을 알아야합니다. 사전에

감사합니다. https://blogs.oracle.com/shay/entry/doing_two_declarative_operatio

답변

1

은 참조 대신 BindingContainer를 얻으려면 액세스하십시오.

// 바인딩 컨테이너 가져 오기 BindingContainer bindings = BindingContext.getCurrent(). getCurrentBindingsEntry();

// 액션 또는 메소드 액션 얻기
OperationBinding 메서드 = bindings.getOperationBinding ("methodAction");
method.execute();
오류 목록 = method.getErrors();

+0

또 다른 매우 유용한 비디오이지만,이 작업은 다른 작업을 수행합니다. 이미 조작 버튼이 있는데 다른 조작을 추가하고 싶지는 않지만 코드에서 조작을 실행하려고합니다. 언 바운드 단추를 대신 사용하므로 내 자신의 사용자 지정 유효성 검사를 먼저 실행할 수 있습니다 .. 고마워요! –

+0

비디오가 보여주는 것은 JDev가 백업 빈에서 작업을 호출하는 코드를 만드는 방법입니다. 그렇게하면 페이지에서 버튼을 제거하고 코드를 백킹 빈에서 사용할 수 있습니다. 그런 다음 추가 한 새 단추와 관련된 빈의 다른 메소드에서 해당 코드를 호출 할 수 있습니다. –

+0

* slaphead * 고맙습니다. 많은 도움을주었습니다. –

1

코드를 당신이 ActionListener를 뒤에 작업을 실행할 :

 public BindingContainer getBindings() { 
      if (this.bindings == null) { 
       FacesContext fc = FacesContext.getCurrentInstance(); 
       this.bindings = (BindingContainer)fc.getApplication(). 
        evaluateExpressionGet(fc, "#{bindings}", BindingContainer.class); 
      } 
      return this.bindings; 
     } 

BindingContainer bindings = getBindings(); 
    OperationBinding operationBinding = 
    bindings.getOperationBinding("doQueryResultReset"); 
    operationBinding.execute(); 
1
조의 대답 유사

하지만 사용하지 않는 EL 표현식 평가를 직접 사용이 도움이 될 것입니다 경우

관련 문제