NetUI Tag Library Documentation (Version 1.0.1)

netui-data
netui-data:getData Tag

This tag evaluates an expression and places the result in the javax.servlet.jsp.PageContext object, where the data is available to the JSP EL and JSP scriptlet.

Syntax

<netui-data:getData
    resultId="string_resultId"
    value="expression_value" >
    ... JSP content ...
</netui-data:getData>

Description

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

In the following example, the getData tag gets the value of a property in the page flow and makes it available to the JSP via the JSP EL implicit object ${pageScope}.

     <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:

     ${pageScope.myData}
 

Attributes
resultId
Required: Yes  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: No

Specifies the property of the PageContext object where the data will be stored.
value
Required: Yes  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: Yes

The data binding expression to evaluate. The result will be stored in the javax.servlet.jsp.PageContext object as specified in the resultId attribute.

Example

In this first example, the <netui-data:getData> tag loads data into the javax.servlet.jsp.PageContext's attribute map. It can then be accessed using the javax.servlet.jsp.PageContext.getAttributegetAttribute(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 example 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:span 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>
 


Tag Information
Tag Classorg.apache.beehive.netui.tags.databinding.script.GetData
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone