org.ujac.web.tag
Class BaseTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.ujac.web.tag.BaseTag
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, Tag, TemplateContextHolder
Direct Known Subclasses:
AlterColumnTag, DefineColumnTag, ExtraRowTag, InsertColumnTag, PrintRowTag, RemoveColumnTag, RowCellTag, SetPropertyTag, SwitchTag

public abstract class BaseTag
extends BodyTagSupport
implements TemplateContextHolder

Name: BaseTag
Description: Base JSP custom tag implementation which provides a smart way to render attributes for generated HTML tags.

Author:
lauerc
See Also:
Serialized Form

Field Summary
protected  org.apache.commons.logging.Log log
          The log writer.
 
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 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
BaseTag()
           
 
Method Summary
 void clearTagAttributes()
          Removes all tag attributes.
 int doStartTag()
           
protected  Tag getParent(Class parentClass)
          Gets the parent tag that matches the given class.
 String getTagAttribute(String name)
          Gets an tag attribute parameter.
 Map getTagAttributes()
          Getter method for the the property tagAttributes.
 TemplateContext getTemplateContext()
          Gets the template context.
 void release()
           
 void removeTagAttribute(String name)
          Removes an tag attribute.
 Object setAttribute(String key, Object value)
          Sets an attribute, both in template context and request.
 void setTagAttribute(String name, String url)
          Sets an tag attribute.
protected  void writeAttributes(PageContext ctx, JspWriter writer)
          Writes the given attributes to the JSP writer.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doEndTag, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, 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, setPageContext, setParent
 

Field Detail

log

protected org.apache.commons.logging.Log log
The log writer.

Constructor Detail

BaseTag

public BaseTag()
Method Detail

writeAttributes

protected void writeAttributes(PageContext ctx,
                               JspWriter writer)
                        throws IOException
Writes the given attributes to the JSP writer.

Parameters:
ctx - The page context.
writer - The JSP writer to output to.
Throws:
IOException - In case the JSP output failed.

getTagAttributes

public Map getTagAttributes()
Getter method for the the property tagAttributes.

Returns:
The current value of property tagAttributes.

getTagAttribute

public String getTagAttribute(String name)
Gets an tag attribute parameter.

Parameters:
name - The name of the tag attribute to get.
Returns:
The tag attribute link.

setTagAttribute

public void setTagAttribute(String name,
                            String url)
Sets an tag attribute.

Parameters:
name - The name of the tag attribute.
url - the action link.

removeTagAttribute

public void removeTagAttribute(String name)
Removes an tag attribute.

Parameters:
name - The name of the tag attribute.

clearTagAttributes

public void clearTagAttributes()
Removes all tag attributes.


doStartTag

public int doStartTag()
               throws JspException
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class BodyTagSupport
Throws:
JspException
See Also:
Tag.doStartTag()

release

public void release()
Specified by:
release in interface Tag
Overrides:
release in class BodyTagSupport
See Also:
BodyTagSupport.release()

getParent

protected Tag getParent(Class parentClass)
Gets the parent tag that matches the given class.

Parameters:
parentClass - The class of the desrired parent tag.
Returns:
The detected parent tag or null.

getTemplateContext

public TemplateContext getTemplateContext()
Gets the template context.

Specified by:
getTemplateContext in interface TemplateContextHolder
Returns:
The associated template context.

setAttribute

public Object setAttribute(String key,
                           Object value)
Sets an attribute, both in template context and request.

Parameters:
key - The attribute key.
value - The attribute value to set.
Returns:
The old value.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.