com.ibm.as400.util.html

Class HTMLServlet

  • All Implemented Interfaces:
    HTMLTagElement, java.io.Serializable


    public class HTMLServlet
    extends HTMLTagAttributes
    implements java.io.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:

    • ElementEvent - The events fired are:
      • elementAdded
      • elementRemoved
    • PropertyChangeEvent
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      HTMLServlet()
      Constructs a default HTMLServlet object.
      HTMLServlet(java.lang.String name)
      Constructs an HTMLServlet object with the specified servlet name.
      HTMLServlet(java.lang.String name, java.lang.String location)
      Constructs an HTMLServlet object with the specified servlet name and location.
    • Constructor Detail

      • HTMLServlet

        public HTMLServlet()
        Constructs a default HTMLServlet object.
      • HTMLServlet

        public HTMLServlet(java.lang.String name)
        Constructs an HTMLServlet object with the specified servlet name.
        Parameters:
        name - The servlet name.
      • HTMLServlet

        public HTMLServlet(java.lang.String name,
                   java.lang.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(java.lang.String name,
                                 java.lang.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 java.lang.String getLocation()
        Returns the location of the servlet.
        Returns:
        The location.
      • getName

        public java.lang.String getName()
        Returns the name of the servlet.
        Returns:
        The name.
      • getText

        public java.lang.String getText()
        Returns the alternate text of the servlet.
        Returns:
        The text.
      • getFOTag

        public java.lang.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 java.lang.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.
      • setLocation

        public void setLocation(java.lang.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(java.lang.String name)
        Sets the class name of the servlet.
        Parameters:
        name - The name.
      • setText

        public void setText(java.lang.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 java.lang.String toString()
        Returns a String representation for the HTMLServlet tag.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The tag.