atg.droplet
Class Tag

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by atg.droplet.Tag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
ComplexTag, FormEventReceiver

public class Tag
extends javax.servlet.GenericServlet

This class implements a simple generic HTML tag. This class can either serve as a base class for other HTML tags or can be used to represent any simple HTML tag directly.

To render an input tag you can use: Tag t = new Tag(); t.setTagName("input"); t.setAttribute("type", "submit"); t.setAttribute("value", "Submit"); t.service(request, response);

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
Tag()
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String pName)
          Returns the value of the specified attribute.
 java.util.Dictionary getAttributes()
          Returns the Attributes dictionary for this tag.
 java.lang.String getTagName()
          Returns the name of this tag or null if no name has been specified.
 void service(DynamoHttpServletRequest pReq, DynamoHttpServletResponse pRes)
          Renders the tag for the given request.
 void service(javax.servlet.ServletRequest pReq, javax.servlet.ServletResponse pRes)
          Vector off service requests to the dynamo specific routine.
protected  void serviceAttributes(DynamoHttpServletRequest pReq, DynamoHttpServletResponse pRes)
          Renders the attributes defined for this tag.
 void setAttribute(java.lang.String pName, java.lang.Object pValue)
          Sets the value of a specific attribute in the Attributes dictionary.
 void setAttributes(java.util.Dictionary pAttributes)
          This sets the "Attributes" property for the Tag.
 void setTagName(java.lang.String pTagName)
          Sets the name of this tag.
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

Tag

public Tag()
Method Detail

setTagName

public void setTagName(java.lang.String pTagName)
Sets the name of this tag.

Parameters:
pTagName - the name of the tag.

getTagName

public java.lang.String getTagName()
Returns the name of this tag or null if no name has been specified.


setAttributes

public void setAttributes(java.util.Dictionary pAttributes)
This sets the "Attributes" property for the Tag. This contains a Dictionary of attribute values that are defined at runtime for the tag object.

Parameters:
pAttributes - the attributes dictionary.

getAttributes

public java.util.Dictionary getAttributes()
Returns the Attributes dictionary for this tag.


setAttribute

public void setAttribute(java.lang.String pName,
                         java.lang.Object pValue)
Sets the value of a specific attribute in the Attributes dictionary.

Parameters:
pName - The name of the attribute
pValue - the value of the attribute. If this value is null, the attribute is deleted. If the attribute is an empty string, the attribute displayed without the "=" sign.

getAttribute

public java.lang.Object getAttribute(java.lang.String pName)
Returns the value of the specified attribute.


service

public void service(javax.servlet.ServletRequest pReq,
                    javax.servlet.ServletResponse pRes)
             throws javax.servlet.ServletException,
                    java.io.IOException
Vector off service requests to the dynamo specific routine. We need to encode URLs for dynamo requests

Specified by:
service in interface javax.servlet.Servlet
Specified by:
service in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException
java.io.IOException

service

public void service(DynamoHttpServletRequest pReq,
                    DynamoHttpServletResponse pRes)
             throws javax.servlet.ServletException,
                    java.io.IOException
Renders the tag for the given request. This method assumes that all attributes defined for the tag are in the Attributes dictionary property. Subclasses can also override this method if they want to define their property values more efficiently as member variables.

Throws:
javax.servlet.ServletException
java.io.IOException

serviceAttributes

protected void serviceAttributes(DynamoHttpServletRequest pReq,
                                 DynamoHttpServletResponse pRes)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
Renders the attributes defined for this tag. Subclasses can use this method to display the attributes in the Attributes dictionary in their service method.

Throws:
javax.servlet.ServletException
java.io.IOException