# <netui-data:callMethod> Tag

This tag is used to call methods on any Java classes within the current Workshop Project.

## Syntax

<netui-data:callMethod
[failOnError="boolean_failOnError"]
[method="string_method"]
[object="string_or_expression_object"]
[resultId="string_resultId"] />

## Description

This tag is used to call methods on any Java classes within the current Workshop Project.

The `controlId` attribute is used to specify the cclass to be called. The value returned is stored in the `{pageContext...}` data binding context object under the attribute specified by the `resultId` attribute.

For example, if you call a Java class with the following <netui-data:callMethod> tag...

        <netui-data:callMethod
              object="{pageFlow}"
              method="hello"
              resultId="helloMessage"
              />

...the result of the call is stored in the `{pageContext...}` data binding context under the attribute `helloMessage`.

The result can be retrieved with the data binding expression `{pageContext.helloMessage}`

       <netui:label value="{pageContext.helloMessage}"/>

In a scriptlet, the result can be retrieved by calling the `getAttribute()` method on the javax.servlet.jsp.PageContext object:

        <%= pageContext.getAttribute("helloMessage") %>

Note that only synchronous methods can be called with <netui-data:callMethod>. For handling asynchronous methods see the help topic Calling Web Services and Custom Java Controls From A Page Flow

## Attributes

failOnError | Boolean. If set to true, any errors occuring while invoking the control method will be be reported in-line on the JSP page.
Required | Supports runtime expression evaluation | Data bindable
No | No | No
method | The name of the method to invoke
Required | Supports runtime expression evaluation | Data bindable
No | No | No
object | A string or data binding expression that names the class on which to call a method.
Required | Supports runtime expression evaluation | Data bindable
No | No | Read Only
resultId | The data returned by the method is loaded into the PageContext object, under this property name.
Required | Supports runtime expression evaluation | Data bindable
No | No | No

## Sample

In this example, the JSP calls the Page Flow method `getShippingState(int i)`. One parameter is passed to the method: the integer 1.

      <netui-data:callMethod object="{pageFlow}" method="getShippingState" failOnError="true" resultId="test">
          <netui-data:methodParameter type="int" value="1" />
      </netui-data:callMethod>

## Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/tagSamples/netui_databinding/callMethod/callMethod.jsp

## Related Topics

<netui-databinding:callMethod> Tag Sample

<netui-data:methodParameter> Tag

<netui-data:callControl> Tag

<netui-data:callPageFlow> Tag