如何从amx页面获取MAF表单布局(只读表单)的值?

时间:2018-01-22 09:56:23

标签: java jdeveloper oracle-maf

我有只读表格。如果用户按是按钮,我想删除与任务ID相关的表单。但是我无法捕获taskid的值以将其发送到我的java类。我怎样才能实现这一目标?我试图这样做但不能删除,因为我没有从表单布局中获得价值。

我想知道如何发送taskid的值(value ="#{bindings.taskId.inputValue}")通过yes按钮有actionListener ="#{closeTask.click}& #34;到我的java课程。

这是我的amx页面。

<?xml version="1.0" encoding="UTF-8" ?>

<amx:view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amx="http://xmlns.oracle.com/adf/mf/amx"

          xmlns:dvtm="http://xmlns.oracle.com/adf/mf/amx/dvt">

  <amx:panelPage id="pp1" >

    <amx:facet name="header">

      <amx:outputText value="Task Details" id="ot1"/>

    </amx:facet>

    <amx:facet name="primary">

      <amx:commandButton id="cb1" action="__back"/>

    </amx:facet>

    <amx:facet name="secondary">

      <amx:commandButton id="cb2"/>

    </amx:facet>

    <amx:validationGroup id="group2">

      <amx:panelFormLayout id="pfl1">

        <amx:panelLabelAndMessage label="#{bindings.taskId.hints.label}" id="plam2">

          <amx:outputText value="#{bindings.taskId.inputValue}" id="ot3"

                          rendered="#{bindings.taskId}"/>

        </amx:panelLabelAndMessage>

        <amx:panelLabelAndMessage label="#{bindings.taskType.hints.label}" id="plam1">

          <amx:outputText value="#{bindings.taskType.inputValue}" id="ot2"/>

        </amx:panelLabelAndMessage>

        <amx:panelLabelAndMessage label="#{bindings.taskName.hints.label}" id="plam3">

          <amx:outputText value="#{bindings.taskName.inputValue}" id="ot5"/>

        </amx:panelLabelAndMessage>

      </amx:panelFormLayout>

    </amx:validationGroup>







    <amx:commandButton text="DELETE" id="cb3"   inlineStyle="left:150px;"  >

    <amx:validationBehavior id="validationBehavior2" group="group2"/>



     <amx:showPopupBehavior popupId="popup1"

                                align="topStart" alignId="pp1" type="action" decoration="anchor" id="spb1"/>



                                 </amx:commandButton>

  </amx:panelPage>

   <amx:popup id="popup1"



              animation="slideUp"

              backgroundDimming="on"

              autoDismiss="true">

    <amx:commandButton text="No" id="cb4" action="__back"/>

    <amx:outputText value="Are you sure?" id="ot4"/>

   <amx:commandButton text="Yes" id="cb5"  actionListener="#{closeTask.click}" />          FROM HERE I AM GETTING THE ISSUE.

    </amx:popup>

</amx:view>

1 个答案:

答案 0 :(得分:1)

在java类中访问绑定值的方法很少。 首先尝试使用closeTask.click方法:

        ValueExpression ve =
        AdfmfJavaUtilities.getValueExpression("#{bindings.taskId.inputValue}", String.class);
    String taskId = (String) ve.getValue(AdfmfJavaUtilities.getELContext());

或者,您可以添加propertylistener以在按钮中传递temp变量:

<amx:commandButton text="Yes" id="cb5">
   <amx:setPropertyListener from="#{bindings.taskId.inputValue}" 
     to="#{viewScope.YourBean.valueHolder}" type="action" id="spl5"/>
            </amx:commandButton> 

当更改vauleHolder时调用closeTask.click: 在YourBean.java中:

private String valueHolder; //declare var

  public void setValueHolder(String valueHolder) {
  this.valueHolder = valueHolder;
  closeTask.click(valueHolder) // call your method here with passed taskid
}

我希望它有所帮助。