netui-data:methodParameter Tag

<netui-data:methodParameter> Tag

This tag provides an argument to a method-calling tag.

Syntax

<netui-data:methodParameter
    [null="boolean_passNullValue"]
    [type="string_type"]
    [value="expression_value"] />

Description

This tag provides an argument to a method-calling tag. The <netui-data:methodParameter> tag can be nested within the following method-calling tags:

Each <netui-data:methodParameter> tag represents a single parameter. A group of <netui-data:methodParameter> tags are evaluated in order and the parameters they describe are passed in order.

Overloaded methods on an object can be invoked by setting the type attribute on each <netui-data:methodParameter> tag that is embedded in a method-calling tag. The type name must exactly match the primitive type name or the fully qualified class name of the argument. The <netui-data:methodParameter> tags must also be in the order that they will be passed to the method. The value of the type attribute must be an exact match of the type as if it were printed after having been accessed through Java reflection.

In order to pass NULL as an argument to a method, the null attribute must be set on this tag. Either the null attribute or the value attribute must be set on this tag.

Attributes

nullBoolean. Determines if the parameter passed to the method is null.
 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

type

Set a String matching the type of this parameter on the method to invoke.

This name should match the primitive type name or fully qualified class name of the parameters on the signature of the method to which this parameter will be passed.

For example:
Method SignatureArgument NameType value
addToPrice(int price)priceint
addToPrice(Integer price)pricejava.lang.Integer

 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

valueThe value of the method parameter that will be passed to the method call.
 
RequiredSupports runtime expression evaluationData bindable
NoNoYes

Sample

The following sample shows how to pass parameters to the method call foo(int integer, String string).
    <netui-data:methodParamter value="42"/>
    <netui-data:methodParamter null="true"/>
This will correspond to the method call:
    foo(42, null);
The following sample shows how to pass parameters to the method call foo(int integer, String string) where the class has both of the methods foo(int integer, String string) and foo(Integer integer, String string).
    <netui-data:methodParamter type="int" value="42"/>
    <netui-data:methodParamter type="java.lang.String" null="true"/>
This will correspond to the method call:

    foo(42, null);

This next example shows a <netui-data:methodParameter> tag being used to specify a dynamic parameter as an argument to the "isItemOnSale" method. The parameter passed is dependent on the current data item in the data set. The <netui-data:methodParameter> tag, in this example, is embedded within a <netui-data:choiceMethod> tag.

    ...
    <netui-data:repeaterItem>
        <netui-data:choiceMethod object="{pageFlow.someDataSet}" method="isItemOnSale">
            <netui-data:methodParameter value="{container.item.quantityavailable}"/>
        </netui-data:choiceMethod>
        <netui-data:choice value="true">
            <tr class="row" bgcolor="#FF9999">
                <td><netui:label value="{container.item.itemnumber}"/></td>
                <td><netui:label value="{container.item.itemname}"/></td>
                <td><netui:label value="{container.item.quantityavailable}"/></td>
                <td><netui:label value="{container.item.price}"/> Clearance Item</td>
            </tr>
        </netui-data:choice>
        <netui-data:choice value="false">
            <tr class="row">
                <td><netui:label value="{container.item.itemnumber}"/></td>
                <td><netui:label value="{container.item.itemname}"/></td>
                <td><netui:label value="{container.item.quantityavailable}"/></td>
                <td><netui:label value="{container.item.price}"/></td>
            </tr>
        </netui-data:choice>
    </netui-data:repeaterItem>
    ...

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/binaryFlow/showImage.jsp [BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/choice/items.jsp [BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/choice/shipping.jsp

Related Topics

<netui-data:callControl> Tag

<netui-data:callMethod> Tag

<netui-data:callPageFlow> Tag

How Do I: Pass Request-time Data to a methodParameter?