org.apache.beehive.netui.tags.databinding.pageinput
Class DeclarePageInput

Object
  extended by TagSupport
      extended by BodyTagSupport
          extended by AbstractClassicTag
              extended by DeclarePageInput
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, JspTag, Tag, INetuiTag

public class DeclarePageInput
extends AbstractClassicTag

The DeclarePageInput tag is used to declare variables that are passed to the page from the page flow. A page input variable has a lifetime of the page in which it is declared and can be referenced using the pageInput data binding context. The name attribute here is used as the identifier for the variable inside of this binding context, and the type attribute is used to identify the expected type of this variable.

See Also:
Serialized Form
Example
This sample shows how a variable, foo, is defined in the Controller file, and its value is passed to a JSP page by using the addPageInput method and the <netui-data:declarePageInput> tag.

Code in the Controller file...

    /**
    * @jpf:action
    * @jpf:forward name="simple" path="simple.jsp"
    */ 
    public Forward simple()
    {
        Forward f = new Forward("simple");
        f.addPageInput("fooBean", new FooBean());
        return f;
    }
   
    public static class FooBean
    {
        private String foo = "A Foo String";
 
        public String getFoo()
        {
            return foo;
        }
  
        public void setFoo(String foo)
        {
            this.foo = foo;
        }
    }

Code in a JSP page...

    <netui-data:declarePageInput name="fooBean" type="pageInput.PageInputController.FooBean"/>
    ...
    fooBean.foo: <netui:label value="{pageInput.fooBean.foo}" />

Field Summary
 
Fields inherited from class AbstractClassicTag
DefaultNamingChain, NETUI_UNIQUE_CNT
 
Fields inherited from class BodyTagSupport
bodyContent
 
Fields inherited from class TagSupport
id, pageContext
 
Fields inherited from interface BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
DeclarePageInput()
           
 
Method Summary
 int doEndTag()
           
 int doStartTag()
           
 String getName()
          Get the name of the variable that can be referenced using the page input data binding context.
 boolean getRequired()
          Get the required attribute that forces a page input to be present for a page.
 String getTagName()
          Get the name of this tag.
 String getType()
          Get the type of the variable that referenced with the setName(java.lang.String) attribute on this tag.
protected  void localRelease()
          Reset all of the fields of this tag.
 void setName(String name)
          Set the name of a variable that can be referecned using the page input data binding context.
 void setRequired(boolean required)
          Set the required attribute.
 void setType(String type)
          Set the type of the variable that referenced with the setName(java.lang.String) attribute on this tag.
 
Methods inherited from class AbstractClassicTag
addTagIdMapping, applyNamingChain, getErrorsReport, getNamingChain, getNextId, getScriptReporter, getUserLocale, hasErrors, qualifyAttribute, registerTagError, registerTagError, renderAttribute, reportAndExit, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write
 
Methods inherited from class BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Tag
getParent, setPageContext, setParent
 

Constructor Detail

DeclarePageInput

public DeclarePageInput()
Method Detail

setName

public void setName(String name)
Set the name of a variable that can be referecned using the page input data binding context.

Parameters:
name - the name of the variable

getName

public String getName()
Get the name of the variable that can be referenced using the page input data binding context.


setRequired

public void setRequired(boolean required)
Set the required attribute. If a Page Input is required, the tag will report an error if the page input key does not appear in the set of page inputs for a page.

Parameters:
required - whether to require the page input for the page

getRequired

public boolean getRequired()
Get the required attribute that forces a page input to be present for a page.


setType

public void setType(String type)
Set the type of the variable that referenced with the setName(java.lang.String) attribute on this tag.

Parameters:
type - the type of the variable that is referenced

getType

public String getType()
Get the type of the variable that referenced with the setName(java.lang.String) attribute on this tag.


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 interface INetuiTag
Specified by:
getTagName in class AbstractClassicTag
Returns:
a constant String representing the name of this tag.

doStartTag

public int doStartTag()
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class BodyTagSupport
Returns:
SKIP_BODY as this tag does not evaluate its body

doEndTag

public int doEndTag()
             throws JspException
Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class BodyTagSupport
Returns:
EVAL_PAGE as this tag always continues to evaluate the page
Throws:
JspException

localRelease

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

Overrides:
localRelease in class AbstractClassicTag