net.sf.ewc.taglib
Class EWCTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byjavax.servlet.jsp.tagext.BodyTagSupport
          extended bynet.sf.ewc.taglib.EWCTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
ContextTag, ElseTag, ForEachTag, IfTag, IncludeTag, LabelTag

public class EWCTag
extends javax.servlet.jsp.tagext.BodyTagSupport

This is the base class that EWC tags should extend. It provide common services to easily develop new tags.

See Also:
Serialized Form

Field Summary
protected  javax.servlet.jsp.JspWriter out
          The JSP writter
protected  javax.servlet.jsp.PageContext pageContext
          The page context
protected  javax.servlet.jsp.tagext.Tag parent
          The tag parent
protected  net.sf.ewc.EWCSession session
          EWCSession
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id
 
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
EWCTag()
          Default constructor.
 
Method Summary
 int doEndTag()
           
 int doStartTag()
           
protected  java.lang.String getComponentPropertyFullExpression(java.lang.String property)
          Returns the expression that access to a component's property
protected  java.lang.String getComponentPropertyValue(java.lang.String property, java.lang.String defValue)
          Returns the component's property value, or the default value if it wasn't set
protected  java.lang.String getComposedExpression(java.lang.String exp1, java.lang.String exp2)
          Composes two expressions in such a way that eval(ctx,compose(exp1,exp2))==eval(eval(ctx,exp1),exp2)
protected  java.lang.String getContextPath()
          Returns the application context path, where the webapp has been hooked.
protected  java.lang.Object getCtx()
          Returns the current context object
protected  java.lang.Object getCtx(int i)
          Returns the current context object
static java.lang.Object getCtx(javax.servlet.jsp.PageContext pageContext)
          Returns the current context object
protected  java.lang.String getCtxPath()
          Returns the current context path
protected  java.lang.String getCtxPath(int i)
          Returns the current context path
protected static java.lang.String getCtxPath(javax.servlet.jsp.PageContext pageContext)
          Returns the current context path
protected  java.util.Stack getCtxStack()
          Returns the context stack for the request
protected static java.util.Stack getCtxStack(javax.servlet.jsp.PageContext pageContext)
          Returns the context stack for the request
protected  java.lang.String getEvent(java.lang.String event)
          Returns the event String that should be sent to the controller.
static net.sf.ewc.EWCSession getEWCSession(javax.servlet.jsp.PageContext pageContext)
          Returns the EWCSessionfor the pageContext
protected  java.lang.Object getExpressionValue(java.lang.Object ctx, java.lang.String fieldExpr)
          Returns the String value of a field expression evaluated on the given context
protected  java.lang.Object getExpressionValue(java.lang.String fieldExpr)
          Returns the value of a field expression evaluated on the current context.
protected  java.lang.String getExpressionValueAsString(java.lang.Object ctx, java.lang.String fieldExpr)
          Returns the String value of a field expression evaluated on the given context
protected  java.lang.String getExpressionValueAsString(java.lang.String fieldExpr)
          Returns the String value of a field expression evaluated on the current context
protected  java.lang.String getFullExpression(java.lang.String exp)
          Composes two expressions in such a way that eval(ctx,compose(exp1,exp2))==eval(eval(ctx,exp1),exp2)
protected  java.lang.String getIndexedExpression(java.lang.String exp1, java.lang.String exp2)
          Returns an indexed expression so eval(ctx, indexed(exp1,exp2))==eval(ctx,exp1)[eval(ctx,exp2)]
 javax.servlet.jsp.tagext.Tag getParent()
          Returns the parent tag
protected static java.util.Stack getStack(javax.servlet.jsp.PageContext pageContext, java.lang.String stackName)
          Returns the context stack for the request
protected  java.util.Stack getStack(java.lang.String stackName)
          Returns the context stack for the request
protected  java.lang.Object[] peekCtx()
          Returns the context info stored on the top of the stack, without poping it
protected static java.lang.Object[] peekCtx(javax.servlet.jsp.PageContext pageContext)
          Returns the context info stored on the top of the stack, without poping it
protected  java.lang.Object[] popCtx()
           
protected  void printAttribute(java.lang.String attName, java.lang.String attValue)
          Prints attName="attValue" through the JSP writer
protected  void printBeginTag(java.lang.String tagName)
          Prints <tagName through the JSP writer
protected  void printEndBeginTag()
          Prints > through the JSP writer
protected  void printEndTag()
          Prints /> through the JSP writer
protected  void printEndTag(java.lang.String tagName)
          Prints </tagName> through the JSP writer
protected  void pushCtx(java.lang.Object ctx, java.lang.String src)
          Pushes a new field context on the stack
protected static void pushCtx(javax.servlet.jsp.PageContext pageContext, java.lang.Object ctx, java.lang.String src)
          Pushes a new field context on the stack
protected static void pushCtx(javax.servlet.jsp.PageContext pageContext, java.lang.String className)
          Pushes a new context on the stack
protected  void pushCtx(java.lang.String className)
          Pushes a new context on the stack
 void release()
           
 void setPageContext(javax.servlet.jsp.PageContext pageContext)
          Sets the page context
 void setParent(javax.servlet.jsp.tagext.Tag parent)
          Sets the parent tag
protected  java.lang.String substituteParentParameters(java.lang.String exp)
          Transforms the user expression, substituting the context parameters
 
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, getValue, getValues, removeValue, setId, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected javax.servlet.jsp.JspWriter out
The JSP writter


pageContext

protected javax.servlet.jsp.PageContext pageContext
The page context


parent

protected javax.servlet.jsp.tagext.Tag parent
The tag parent


session

protected net.sf.ewc.EWCSession session
EWCSession

Constructor Detail

EWCTag

public EWCTag()
Default constructor.

Method Detail

getEWCSession

public static net.sf.ewc.EWCSession getEWCSession(javax.servlet.jsp.PageContext pageContext)
Returns the EWCSessionfor the pageContext

Returns:
The EWCSession

getContextPath

protected java.lang.String getContextPath()
Returns the application context path, where the webapp has been hooked. Use this method instead of hardcoding the webapp name in your code.

Returns:
The application context path

getStack

protected static java.util.Stack getStack(javax.servlet.jsp.PageContext pageContext,
                                          java.lang.String stackName)
Returns the context stack for the request

Parameters:
pageContext -
stackName -
Returns:
The context Stack

getStack

protected java.util.Stack getStack(java.lang.String stackName)
Returns the context stack for the request

Parameters:
stackName -
Returns:
The context Stack

getCtxStack

protected static java.util.Stack getCtxStack(javax.servlet.jsp.PageContext pageContext)
Returns the context stack for the request

Returns:
The context Stack

getCtxStack

protected java.util.Stack getCtxStack()
Returns the context stack for the request

Returns:
The context Stack

pushCtx

protected static void pushCtx(javax.servlet.jsp.PageContext pageContext,
                              java.lang.String className)
Pushes a new context on the stack

Parameters:
className - The new context class name

pushCtx

protected void pushCtx(java.lang.String className)
Pushes a new context on the stack

Parameters:
className - The new context class name

pushCtx

protected static void pushCtx(javax.servlet.jsp.PageContext pageContext,
                              java.lang.Object ctx,
                              java.lang.String src)
Pushes a new field context on the stack

Parameters:
ctx - The new context
src - The relative path to navigate from the last context to the new one

pushCtx

protected void pushCtx(java.lang.Object ctx,
                       java.lang.String src)
Pushes a new field context on the stack

Parameters:
ctx - The new context
src - The relative path to navigate from the last context to the new one

peekCtx

protected static java.lang.Object[] peekCtx(javax.servlet.jsp.PageContext pageContext)
Returns the context info stored on the top of the stack, without poping it

Returns:
The TOS of the context stack

peekCtx

protected java.lang.Object[] peekCtx()
Returns the context info stored on the top of the stack, without poping it

Returns:
The TOS of the context stack

popCtx

protected java.lang.Object[] popCtx()
Returns:

getCtx

public static java.lang.Object getCtx(javax.servlet.jsp.PageContext pageContext)
Returns the current context object

Parameters:
pageContext -
Returns:
The current context object

getCtx

protected java.lang.Object getCtx()
Returns the current context object

Returns:
The current context object

getCtx

protected java.lang.Object getCtx(int i)
Returns the current context object

Returns:
The current context object

getCtxPath

protected static java.lang.String getCtxPath(javax.servlet.jsp.PageContext pageContext)
Returns the current context path

Returns:

getCtxPath

protected java.lang.String getCtxPath()
Returns the current context path

Returns:

getCtxPath

protected java.lang.String getCtxPath(int i)
Returns the current context path

Returns:

getExpressionValue

protected java.lang.Object getExpressionValue(java.lang.Object ctx,
                                              java.lang.String fieldExpr)
Returns the String value of a field expression evaluated on the given context

Parameters:
fieldExpr - The field expression to evaluate
Returns:
The result as String of the expression evaluation

getExpressionValueAsString

protected java.lang.String getExpressionValueAsString(java.lang.Object ctx,
                                                      java.lang.String fieldExpr)
Returns the String value of a field expression evaluated on the given context

Parameters:
fieldExpr - The field expression to evaluate
Returns:
The result as String of the expression evaluation

getExpressionValue

protected java.lang.Object getExpressionValue(java.lang.String fieldExpr)
Returns the value of a field expression evaluated on the current context. This current context can be modified using "../" subexpressions. Thus, "../.name" is conceptually equivalent to "getParent().getName()".

Parameters:
fieldExpr - The field expression to evaluate
Returns:
The result of the expression evaluation

getExpressionValueAsString

protected java.lang.String getExpressionValueAsString(java.lang.String fieldExpr)
Returns the String value of a field expression evaluated on the current context

Parameters:
fieldExpr - The field expression to evaluate
Returns:
The result as String of the expression evaluation

substituteParentParameters

protected java.lang.String substituteParentParameters(java.lang.String exp)
Transforms the user expression, substituting the context parameters

Returns:

getComponentPropertyValue

protected java.lang.String getComponentPropertyValue(java.lang.String property,
                                                     java.lang.String defValue)
Returns the component's property value, or the default value if it wasn't set

Parameters:
property - The property name
defValue - The default value
Returns:
The property value

getComponentPropertyFullExpression

protected java.lang.String getComponentPropertyFullExpression(java.lang.String property)
Returns the expression that access to a component's property

Parameters:
property - The property
Returns:

getFullExpression

protected java.lang.String getFullExpression(java.lang.String exp)
Composes two expressions in such a way that eval(ctx,compose(exp1,exp2))==eval(eval(ctx,exp1),exp2)

Returns:
The composed expression

getComposedExpression

protected java.lang.String getComposedExpression(java.lang.String exp1,
                                                 java.lang.String exp2)
Composes two expressions in such a way that eval(ctx,compose(exp1,exp2))==eval(eval(ctx,exp1),exp2)

Parameters:
exp1 - The first expression
exp2 - The secont expression
Returns:
The composed expression

getIndexedExpression

protected java.lang.String getIndexedExpression(java.lang.String exp1,
                                                java.lang.String exp2)
Returns an indexed expression so eval(ctx, indexed(exp1,exp2))==eval(ctx,exp1)[eval(ctx,exp2)]

Parameters:
exp1 - The first expression
exp2 - The secont expression
Returns:
The indexed expression

getEvent

protected java.lang.String getEvent(java.lang.String event)
Returns the event String that should be sent to the controller. It just adds the context.

Parameters:
event -
Returns:

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Returns:
Returns the next processing action
Throws:
javax.servlet.jsp.JspException

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Returns:
Returns the next processing action
Throws:
javax.servlet.jsp.JspException

release

public void release()

setPageContext

public void setPageContext(javax.servlet.jsp.PageContext pageContext)
Sets the page context

Parameters:
pageContext - The page context

setParent

public void setParent(javax.servlet.jsp.tagext.Tag parent)
Sets the parent tag

Parameters:
parent - The parent tag

getParent

public javax.servlet.jsp.tagext.Tag getParent()
Returns the parent tag

Returns:
The parent tag

printBeginTag

protected void printBeginTag(java.lang.String tagName)
                      throws java.io.IOException
Prints <tagName through the JSP writer

Parameters:
tagName - The tag name
Throws:
java.io.IOException

printAttribute

protected void printAttribute(java.lang.String attName,
                              java.lang.String attValue)
                       throws java.io.IOException
Prints attName="attValue" through the JSP writer

Parameters:
attName - The attribute name
attValue - The attribute value
Throws:
java.io.IOException

printEndBeginTag

protected void printEndBeginTag()
                         throws java.io.IOException
Prints > through the JSP writer

Throws:
java.io.IOException

printEndTag

protected void printEndTag()
                    throws java.io.IOException
Prints /> through the JSP writer

Throws:
java.io.IOException

printEndTag

protected void printEndTag(java.lang.String tagName)
                    throws java.io.IOException
Prints </tagName> through the JSP writer

Parameters:
tagName - The tag name
Throws:
java.io.IOException


Copyright © 2003-2004 SourceForge. All Rights Reserved.