All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.util.html.HTMLForm

java.lang.Object
   |
   +----com.ibm.as400.util.html.HTMLForm

public class HTMLForm
extends Object
implements HTMLTagElement, HTMLConstants, Serializable
The HTMLForm class represents an HTML form.

HTMLForm objects generate the following events:

This examples creates an HTMLForm object and adds some form input types to it.

  
  

// Create a text input form element for the system. LabelFormElement sysPrompt = new LabelFormElement("System:"); TextFormInput system = new TextFormInput("System");

// Create a text input form element for the userId. LabelFormElement userPrompt = new LabelFormElement("User:"); TextFormInput user = new TextFormInput("User");

// Create a password input form element for the password. LabelFormElement passwordPrompt = new LabelFormElement("Password:"); PasswordFormInput password = new PasswordFormInput("Password");

// Create a properties object. Properties prop = new Properties();

// Add customer name and ID values to the properties object. prop.put("custName", "Mr. Toolbox"); prop.put("custID", "12345");

// Create the submit button to the form. SubmitFormInput logonButton = new SubmitFormInput("logon", "Logon");

// Create HTMLForm object and add the panel to it. HTMLForm form = new HTMLForm(servletURI); form.setHiddenParameterList(prop); form.addElement(sysPrompt); form.addElement(system); form.addElement(userPrompt); form.addElement(user); form.addElement(passwordPrompt); form.addElement(password); form.addElement(logonButton);

Here is an example of an HTMLForm tag:

<form action="servletURI" method="get"> System: <input type="text" name="System" /> User: <input type="text" name="User" /> Password: <input type="password" name="Password" /> <input type="submit" name="logon" value="Logon" /> <input type="hidden" name="custName" value="Mr. Toolbox" /> <input type="hidden" name="custID" value="12345" /> </form>


Variable Index

 o METHOD_GET
HTTP GET Method for sending form contents to the server.
 o METHOD_POST
HTTP POST Method for sending form contents to the server.

Constructor Index

 o HTMLForm()
Constructs a default HTMLForm object.
 o HTMLForm(String)
Constructs an HTMLForm object with the specified URL.

Method Index

 o addElement(HTMLTagElement)
Adds a form element to the HTMLForm.
 o addElementListener(ElementListener)
Adds an ElementListener.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a PropertyChangeListener.
 o addVetoableChangeListener(VetoableChangeListener)
Adds the VetoableChangeListener.
 o getHiddenParameterList()
Returns the form's hidden parameter list.
 o getMethod()
Returns the HTTP method used for sending form contents to the server.
 o getTag()
Returns the HTML form tag.
 o getTarget()
Returns the target frame for the form response.
 o getURL()
Returns the ACTION URL address of the server-side form handler.
 o isUseGet()
Indicates if the GET method is used for sending the form contents to the server.
 o isUsePost()
Indicates if the POST method is used for sending the form contents to the server.
 o removeElement(HTMLTagElement)
Removes a form element from the HTMLForm.
 o removeElementListener(ElementListener)
Removes this ElementListener from the internal list.
 o removePropertyChangeListener(PropertyChangeListener)
Removes the PropertyChangeListener from the internal list.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes the VetoableChangeListener from the internal list.
 o setHiddenParameterList(Properties)
Sets the form's hidden parameter list.
 o setMethod(int)
Sets the HTTP method used to send form contents to the server.
 o setTarget(String)
Sets the target frame for the form response.
 o setURL(String)
Sets the ACTION URL address of the server-side form handler.
 o toString()
Returns the HTMLForm tag as a String.

Variables

 o METHOD_GET
 public static final int METHOD_GET
HTTP GET Method for sending form contents to the server. This is the default method used.

 o METHOD_POST
 public static final int METHOD_POST
HTTP POST Method for sending form contents to the server.

Constructors

 o HTMLForm
 public HTMLForm()
Constructs a default HTMLForm object.

 o HTMLForm
 public HTMLForm(String url)
Constructs an HTMLForm object with the specified URL.

Parameters:
url - The URL address.

Methods

 o addElement
 public void addElement(HTMLTagElement element)
Adds a form element to the HTMLForm.

Parameters:
element - The form element.
 o addElementListener
 public void addElementListener(ElementListener listener)
Adds an ElementListener. The ElementListener object is added to an internal list of ElementListeners; it can be removed with removeElementListener.

Parameters:
listener - The ElementListener.
See Also:
removeElementListener
 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method is called each time the value of any bound property is changed.

Parameters:
listener - The PropertyChangeListener.
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
 public void addVetoableChangeListener(VetoableChangeListener listener)
Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method is called each time the value of any constrained property is changed.

Parameters:
listener - The VetoableChangeListener.
See Also:
removeVetoableChangeListener
 o getHiddenParameterList
 public Properties getHiddenParameterList()
Returns the form's hidden parameter list.

Returns:
The parameter list.
 o getMethod
 public int getMethod()
Returns the HTTP method used for sending form contents to the server.

Returns:
The HTTP method.
 o getTag
 public String getTag()
Returns the HTML form tag.

Returns:
The tag.
 o getTarget
 public String getTarget()
Returns the target frame for the form response.

Returns:
The target frame. One of the following constants defined in HTMLConstants: TARGET_BLANK, TARGET_PARENT, TARGET_SELF, TARGET_TOP, or a user defined target.
See Also:
HTMLConstants
 o getURL
 public String getURL()
Returns the ACTION URL address of the server-side form handler.

Returns:
The URL address.
 o isUseGet
 public boolean isUseGet()
Indicates if the GET method is used for sending the form contents to the server.

Returns:
true if GET is used; false otherwise.
 o isUsePost
 public boolean isUsePost()
Indicates if the POST method is used for sending the form contents to the server.

Returns:
true if POST is used; false otherwise.
 o removeElement
 public void removeElement(HTMLTagElement element)
Removes a form element from the HTMLForm.

Parameters:
element - The form element.
 o 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
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the PropertyChangeListener from the internal list. If the PropertyChangeListener is not on the list, nothing is done.

Parameters:
listener - The PropertyChangeListener.
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
 public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes the VetoableChangeListener from the internal list. If the VetoableChangeListener is not on the list, nothing is done.

Parameters:
listener - The VetoableChangeListener.
See Also:
addVetoableChangeListener
 o setHiddenParameterList
 public void setHiddenParameterList(Properties parameterList) throws PropertyVetoException
Sets the form's hidden parameter list.

Parameters:
parameterList - The parameter list.
Throws: PropertyVetoException
If a change is vetoed.
 o setMethod
 public void setMethod(int method) throws PropertyVetoException
Sets the HTTP method used to send form contents to the server.

Parameters:
method - The method.
Throws: PropertyVetoException
If a change is vetoed.
 o setTarget
 public void setTarget(String target) throws PropertyVetoException
Sets the target frame for the form response.

Parameters:
target - The target frame. One of the following constants defined in HTMLConstants: TARGET_BLANK, TARGET_PARENT, TARGET_SELF, TARGET_TOP, or a user defined target.
Throws: PropertyVetoException
If a change is vetoed.
See Also:
HTMLConstants
 o setURL
 public void setURL(String url) throws PropertyVetoException
Sets the ACTION URL address of the server-side form handler.

Parameters:
url - The URL address.
Throws: PropertyVetoException
If a change is vetoed.
 o toString
 public String toString()
Returns the HTMLForm tag as a String.

Returns:
The tag.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index