org.ultrawork.wtk.helper.taglib
Class CreateTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--org.ultrawork.wtk.helper.taglib.CreateTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class CreateTag
extends javax.servlet.jsp.tagext.TagSupport

Creates a temporary scripting variable based on a ViewHelper class which will not be exposed outside of the Tag scope.

Version:
0.2
Author:
Nicolas Bonvin
See Also:
Serialized Form

Field Summary
private  ViewHelper helper
           
private  java.lang.String id
          The name of the scripting variable that will be exposed inside of the Tag.
protected  java.lang.Object initialVariable
          The initial scripting variable found in the PageContext under the id key.
private  PerformResult result
           
protected  java.lang.String type
          The fully qualified Java class name of the ViewHelper to create.
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
pageContext, parent, values
 
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
CreateTag()
           
 
Method Summary
private  java.lang.Object createHelper(java.lang.String helperType, javax.servlet.ServletContext context, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
           
 int doEndTag()
          Restore the previous scripting variable if any.
 int doStartTag()
          Instantiate a ViewHelper object, store it in the request and expose it as a scripting variable in the page scope.
protected  ViewHelper getHelper()
           
 java.lang.String getId()
           
protected  PerformResult getPerformResult()
           
 java.lang.String getType()
           
 void release()
          Release all allocated resources.
private  void removeCurrentVariableFromPageContext()
           
private  void restoreInitialVariableValue(java.lang.String id)
           
protected  void setHelper(ViewHelper helper)
           
 void setId(java.lang.String id)
           
protected  void setPerformResult(PerformResult result)
           
 void setType(java.lang.String type)
           
private  void storeInitialVariableValue(java.lang.String id)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

id

private java.lang.String id
The name of the scripting variable that will be exposed inside of the Tag.

type

protected java.lang.String type
The fully qualified Java class name of the ViewHelper to create.

initialVariable

protected java.lang.Object initialVariable
The initial scripting variable found in the PageContext under the id key.

helper

private ViewHelper helper

result

private PerformResult result
Constructor Detail

CreateTag

public CreateTag()
Method Detail

getType

public java.lang.String getType()

setType

public void setType(java.lang.String type)

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspTagException
Instantiate a ViewHelper object, store it in the request and expose it as a scripting variable in the page scope.
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Throws:
javax.servlet.jsp.JspTagException - if a Tag exception has occurred

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspTagException
Restore the previous scripting variable if any. Remove the viewhelper object from the page scope.
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport
Throws:
javax.servlet.jsp.JspTagException - if a Tag exception occurs

storeInitialVariableValue

private void storeInitialVariableValue(java.lang.String id)

createHelper

private java.lang.Object createHelper(java.lang.String helperType,
                                      javax.servlet.ServletContext context,
                                      javax.servlet.ServletRequest request,
                                      javax.servlet.ServletResponse response)
                               throws javax.servlet.jsp.JspTagException

restoreInitialVariableValue

private void restoreInitialVariableValue(java.lang.String id)

removeCurrentVariableFromPageContext

private void removeCurrentVariableFromPageContext()

release

public void release()
Release all allocated resources.
Overrides:
release in class javax.servlet.jsp.tagext.TagSupport

getHelper

protected ViewHelper getHelper()

setHelper

protected void setHelper(ViewHelper helper)

getPerformResult

protected PerformResult getPerformResult()

setPerformResult

protected void setPerformResult(PerformResult result)

getId

public java.lang.String getId()
Overrides:
getId in class javax.servlet.jsp.tagext.TagSupport

setId

public void setId(java.lang.String id)
Overrides:
setId in class javax.servlet.jsp.tagext.TagSupport


Copyright 2002 - ultrawork