com.ibm.as400.util.html
Class HTMLServlet

java.lang.Object
  extended by com.ibm.as400.util.html.HTMLTagAttributes
      extended by com.ibm.as400.util.html.HTMLServlet
All Implemented Interfaces:
HTMLTagElement, Serializable

public class HTMLServlet
extends HTMLTagAttributes
implements Serializable

The HTMLServlet class represents a server-side include in an HTML page.

This example creates a HTMLServlet tag:

  // Create an HTMLServlet.
  HTMLServlet servlet = new HTMLServlet("myServlet", "http://server:port/dir");
  

// Create a parameter, then add it to the servlet. HTMLParameter param = new HTMLParameter("parm1", "value1"); servlet.addParameter(param);

// Create and add second parameter HTMLParameter param2 = servlet.add("parm2", "value2"); System.out.println(servlet);

Here is the output of the HTMLServlet tag:

  <servlet name="myServlet" codebase="http://server:port/dir">
  <param name="parm1" value="value1">
  <param name="parm2" value="value2">
  If you see this text, the web server providing this page does not support the SERVLET tag.
  </servlet>
  

HTMLServlet objects generate the following events:

See Also:
Serialized Form

Constructor Summary
Constructor and Description
HTMLServlet()
          Constructs a default HTMLServlet object.
HTMLServlet(String name)
          Constructs an HTMLServlet object with the specified servlet name.
HTMLServlet(String name, String location)
          Constructs an HTMLServlet object with the specified servlet name and location.
 
Method Summary
Modifier and Type Method and Description
 void addElementListener(ElementListener listener)
          Adds an addElementListener.
 void addParameter(HTMLParameter param)
          Adds an HTMLparameter to the servlet tag.
 HTMLParameter addParameter(String name, String value)
          Adds an HTMLParameter to the servlet.
 String getFOTag()
          Returns a comment tag.
 String getLocation()
          Returns the location of the servlet.
 String getName()
          Returns the name of the servlet.
 String getTag()
          Returns the tag for the HTML servlet.
 String getText()
          Returns the alternate text of the servlet.
 void removeElementListener(ElementListener listener)
          Removes this ElementListener from the internal list.
 void removeParameter(HTMLParameter param)
          Removes an HTMLParameter from the servlet tag.
 void setLocation(String location)
          Sets the location for the servlet source.
 void setName(String name)
          Sets the class name of the servlet.
 void setText(String text)
          Set the alternate text for the servlet, which will be displayed if the web server does not support the servlet tag.
 String toString()
          Returns a String representation for the HTMLServlet tag.
 
Methods inherited from class com.ibm.as400.util.html.HTMLTagAttributes
addPropertyChangeListener, getAttributes, getAttributeString, removePropertyChangeListener, setAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTMLServlet

public HTMLServlet()
Constructs a default HTMLServlet object.


HTMLServlet

public HTMLServlet(String name)
Constructs an HTMLServlet object with the specified servlet name.

Parameters:
name - The servlet name.

HTMLServlet

public HTMLServlet(String name,
                   String location)
Constructs an HTMLServlet object with the specified servlet name and location.

Parameters:
name - The servlet name.
location - The servlet location (http://server:port/dir).
Method Detail

addParameter

public void addParameter(HTMLParameter param)
Adds an HTMLparameter to the servlet tag.

Parameters:
param - The parameter.

addParameter

public HTMLParameter addParameter(String name,
                                  String value)
Adds an HTMLParameter to the servlet.

Parameters:
name - The parameter name.
value - The parameter value.
Returns:
A HTMLParameter object.

addElementListener

public void addElementListener(ElementListener listener)
Adds an addElementListener. The specified addElementListeners elementAdded method will be called each time a HTMLParameter is added to the group. The addElementListener object is added to a list of addElementListeners managed by this HTMLServlet. It can be removed with removeElementListener.

Parameters:
listener - The ElementListener.
See Also:
removeElementListener(com.ibm.as400.util.html.ElementListener)

getLocation

public String getLocation()
Returns the location of the servlet.

Returns:
The location.

getName

public String getName()
Returns the name of the servlet.

Returns:
The name.

getText

public String getText()
Returns the alternate text of the servlet.

Returns:
The text.

getFOTag

public String getFOTag()
Returns a comment tag. This method should not be called. There is no XSL-FO support for this class.

Specified by:
getFOTag in interface HTMLTagElement
Returns:
The comment tag.

getTag

public String getTag()
Returns the tag for the HTML servlet.

Specified by:
getTag in interface HTMLTagElement
Returns:
The tag.

removeParameter

public void removeParameter(HTMLParameter param)
Removes an HTMLParameter from the servlet tag.

Parameters:
param - The parameter.

removeElementListener

public void removeElementListener(ElementListener listener)
Removes this ElementListener from the internal list. If the ElementListener is not on the list, nothing is done.

Parameters:
listener - The ElementListener.
See Also:
addElementListener(com.ibm.as400.util.html.ElementListener)

setLocation

public void setLocation(String location)
Sets the location for the servlet source. It can refer to a remote location from which the servlet should be loaded. The default location is assumed to be local.

Parameters:
location - The location.

setName

public void setName(String name)
Sets the class name of the servlet.

Parameters:
name - The name.

setText

public void setText(String text)
Set the alternate text for the servlet, which will be displayed if the web server does not support the servlet tag.

Parameters:
text - The alternate text.

toString

public String toString()
Returns a String representation for the HTMLServlet tag.

Overrides:
toString in class Object
Returns:
The tag.