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.script
Class GetData

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.script.GetData
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

public class GetData
extends AbstractBaseTag

This tag evaluates an expression and places the result of expression evaluation in a JSP's PageContext. This can be used to extract objects from forms, page flows, and other objects that can be databound; once in the JSP, scriptlet can be written using these objects by accessing them through the JspContext.getAttribute(java.lang.String) method.

Attribute Descriptions
AttributeRequiredRuntime Expression EvaluationData Bindable
resultIdYesNoYes
The String identifier under which the Object resulting from expression evaluation will be stored.
valueYesNoYes
The expression that references the data to store in the PageContext attribute map.

See Also:
<netui-data:getData> Tag Sample, Using Data Binding in Page Flows (PageContext section), javax.servlet.jsp.PageContext, Serialized Form
Example:
In this first sample, the <netui-data:getData> tag loads data into the PageContext object. You can subsequently access the data through the PageContext's getAttribute(String) method.
    <netui:form action="lastNameAction" focus="lastname">
         ...
         <netui-data:getData resultId="first" value="{actionForm.firstname}"/>
         ...
         <% 
             String firstName = (String) pageContext.getAttribute("first");
             System.out.println("First Name = " + firstName);
             ...
         %>
         ...
     </netui:form>

This next sample shows how to use <netui-data:getData> and the PageContext inside of other containers, in this case a <netui-data:repeater> tag. The <netui-data:getData> below extracts each element as the <netui-data:repeater> iterates over the data set and writes it to the Java console:

    <netui-data:repeater dataSource="{pageFlow.strArr}">
         ...
         <netui-data:repeaterItem>
             <netui:label value="{container.item}" />
             <netui-data:getData resultId="item" value="{container.item}"/>
             <% 
                 String currentItem = (String) pageContext.getAttribute("item");
                 System.out.println(currentItem);
                 ...
             %>
          </netui-data:repeaterItem>
          ...
      </netui-data:repeater>

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/getData/

Beadoc.tagdescription:
This tag evaluates an expression and places the result in the javax.servlet.jsp.PageContext object, where the data is available to JSP scriptlets. This tag can be used to extract data from forms, Controller files, and any data binding context and make it available to scriptlets.

The following <netui-data:getData> tag extracts data from the Controller file and places it in the myData field of the PageContext object:

    <netui-data:getData resultId="myData" value="{pageFlow.myData}"/>

The following scriptlet extracts the data from the PageContext object and writes it to the rendered HTML:

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

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
GetData()
           
 
Method Summary
 int doEndTag()
          Evaluate the expression at the value attribute and store the result in the PageContext under the attribute key resultId.
 int doStartTag()
          Start the tag evaluation.
 String getResultId()
          Get the key under which the result of evaluating the expression will be stored in the PageContext.
 String getTagName()
          Get the name of this tag.
 String getValue()
          Get the expression to evaluate.
protected  void localRelease()
          Reset all of the fields of this tag.
 void setResultId(String resultId)
          Set the String key under which the result of evaluating an expression will be stored in the PageContext.
 void setValue(String value)
          Set the expression to evaluate.
 
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

GetData

public GetData()
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.

setValue

public void setValue(String value)
Set the expression to evaluate.

Parameters:
value - the expression to evaluate
Beadoc.attributedescription:
The data binding expression to evaluate. The result will be stored in the PageContext object as specified in the resultId attribute.
Beadoc.attributesyntaxvalue:
expression_value
Beadoc.databindable:
true

getValue

public String getValue()
Get the expression to evaluate.

Returns:
the expression to evaluate

setResultId

public void setResultId(String resultId)
Set the String key under which the result of evaluating an expression will be stored in the PageContext.

Parameters:
resultId - the String key
Beadoc.attributedescription:
Specifies the property of the PageContext object where the data will be stored.
Beadoc.attributesyntaxvalue:
string_resultId
Beadoc.databindable:
false

getResultId

public String getResultId()
Get the key under which the result of evaluating the expression will be stored in the PageContext.

Returns:
the String key

doStartTag

public int doStartTag()
Start the tag evaluation. This tag ignores its body content.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
SKIP_BODY

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Evaluate the expression at the value attribute and store the result in the PageContext under the attribute key resultId. If an existing key in the PageContext's attribute map exists, a warning will be written to the log file. If errors occur during expression evaluation, they will be reported in the JSP page. If the value returned by the expression is null, an attribute named resultId will be removed from the PageContext's attribute map.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_PAGE
Throws:
javax.servlet.jsp.JspException

localRelease

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

Overrides:
localRelease in class AbstractBaseTag

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