BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.

com.bea.wlw.netui.tags.databinding.invoke
Class CallMethod

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by com.bea.wlw.netui.tags.AbstractBaseTag
              extended by com.bea.wlw.netui.tags.databinding.invoke.AbstractCallMethod
                  extended by com.bea.wlw.netui.tags.databinding.invoke.CallMethod
All Implemented Interfaces:
HtmlConstants, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
CallPageFlow, ChoiceMethod

public class CallMethod
extends AbstractCallMethod

An abstract base class for tags that are capable of reflectively invoking methods. Specializations of this tag provide method implementations that locate the object on which to invoke the method and that handle any return value from the invoked method.

The CallMethod tag can have child tags of type MethodParameter; these tags must be in the same order as the parameter list in the method signature of the method that will be invoked. To invoke an overloaded method, the MethodParameter.setValue(java.lang.String)} property must be set to the String name of the type to pass to the method. If the type attribute values on nested MethodParameter tags do not match any method signature, an error will be reported in the page.

Attribute Descriptions
AttributeRequiredRuntime Expression EvaluationData Bindable
failOnErrorNoNoNo
A boolean that if true will cause the tag to report any method invocation errors in-line in the rendered page.
methodNoNoNo
The method to invoke on an object.
objectNoNoYes
References an object on which the method will be invoked.
resultIdNoNoNo
The PageContext attribute name where the result, if non-null, is stored.

See Also:
MethodParameter, CallControl, CallPageFlow, Serialized Form
Example:
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

Beadoc.see:
<netui-databinding:callMethod> Tag Sample
Beadoc.tagdescription:
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


Nested Class Summary
 
Nested classes/interfaces inherited from class com.bea.wlw.netui.tags.databinding.invoke.AbstractCallMethod
AbstractCallMethod.ParamNode
 
Field Summary
 
Fields inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface com.bea.wlw.netui.tags.html.HtmlConstants
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
CallMethod()
           
 
Method Summary
protected  Method findMethod(Object target, String methodName, boolean verifyTypes)
          The default findMethod implementation is an uncached search of all of the methods available on the Class of the target
 String getObject()
          Get the object on which a method will be invoked.
protected  String getObjectName()
          Get the name of the object that is the target of the invocation.
 String getTagName()
          Get the name of this tag.
protected  void localRelease()
          Reset all of the fields of this tag.
protected  Object resolveObject()
           Resolve the object on which the method should be invoked.
 void setObject(String object)
          Set the object on which to invoke a method.
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.invoke.AbstractCallMethod
addParameter, doEndTag, doStartTag, getFailOnError, getMethod, getParameterNodes, getResultId, handleReturnValue, setFailOnError, setMethod, setResultId
 
Methods inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
addTagIdMapping, containsExpression, evaluateAttributeToString, evaluateExpression, filter, filter, formatErrorString, formatString, getAttribute, getErrorsReport, getExpressionEvaluator, getJavaScriptUtils, getNearestForm, getNextId, getQualifiedBundleName, getScriptReporter, getUserLocale, hasErrors, isExpression, prepForRendering, registerAttribute, registerError, registerTagError, release, removeAttribute, renderAttribute, renderAttributes, reportErrors, rewriteName, setPageContext, updateExpression, write
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Constructor Detail

CallMethod

public CallMethod()
Method Detail

getTagName

public String getTagName()
Get the name of this tag. This is used to identify the type of this tag for reporting tag errors.

Specified by:
getTagName in class AbstractBaseTag
Returns:
a constant String representing the name of this tag.

setObject

public void setObject(String object)
Set the object on which to invoke a method.

Parameters:
object - the object on which to invoke a method
Beadoc.attributedescription:
A string or data binding expression that names the class on which to call a method.
Beadoc.attributesyntaxvalue:
string_or_expression_object
Beadoc.databindable:
Read Only

getObject

public String getObject()
Get the object on which a method will be invoked.


localRelease

protected void localRelease()
Reset all of the fields of this tag.

Overrides:
localRelease in class AbstractCallMethod

resolveObject

protected Object resolveObject()
                        throws ObjectNotFoundException
Description copied from class: AbstractCallMethod

Resolve the object on which the method should be invoked. If there are errors resolving this object, this method will throw an ObjectNotFoundException.

If the object is not found but no exception occurred, this method should return null.

Specified by:
resolveObject in class AbstractCallMethod
Returns:
the object on which to reflectively invoke the method.
Throws:
ObjectNotFoundException - if an exception occurred attempting to resolve an object

findMethod

protected final Method findMethod(Object target,
                                  String methodName,
                                  boolean verifyTypes)
Description copied from class: AbstractCallMethod
The default findMethod implementation is an uncached search of all of the methods available on the Class of the target

Overrides:
findMethod in class AbstractCallMethod
Parameters:
target - the object from which to find the method
methodName - the name of the method to find
verifyTypes - a boolean that if true will match the type names in addition to the String method name
Returns:
a Method object matching the methodName and types, if verifyTypes is true. null otherwise.

getObjectName

protected String getObjectName()
Description copied from class: AbstractCallMethod
Get the name of the object that is the target of the invocation. This is a generic method for this tag that enables more specific error reporting.

Specified by:
getObjectName in class AbstractCallMethod
Returns:
a name for the object on which the method will be invoked.

BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.