|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.as400.util.html.HTMLTagAttributes | +--com.ibm.as400.util.html.HTMLForm
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>
Field Summary | |
static int |
METHOD_GET
HTTP GET Method for sending form contents to the server. |
static int |
METHOD_POST
HTTP POST Method for sending form contents to the server. |
Fields inherited from interface com.ibm.as400.util.html.HTMLConstants |
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CAPITALS, CENTER, CIRCLE, DISC, JUSTIFY, LARGE_ROMAN, LEFT, LOWER_CASE, LTR, MIDDLE, NUMBERS, RIGHT, RTL, SMALL_ROMAN, SQUARE, TARGET_BLANK, TARGET_PARENT, TARGET_SELF, TARGET_TOP, TEXTTOP, TOP |
Constructor Summary | |
HTMLForm()
Constructs a default HTMLForm object. |
|
HTMLForm(java.lang.String url)
Constructs an HTMLForm object with the specified URL. |
Method Summary | |
void |
addElement(HTMLTagElement element)
Adds a form element to the HTMLForm. |
void |
addElementListener(ElementListener listener)
Adds an ElementListener. |
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds the VetoableChangeListener. |
java.lang.String |
getDirection()
Returns the direction of the text interpretation. |
java.util.Properties |
getHiddenParameterList()
Returns the form's hidden parameter list. |
java.lang.String |
getLanguage()
Returns the language of the input element. |
int |
getMethod()
Returns the HTTP method used for sending form contents to the server. |
java.lang.String |
getTag()
Returns the HTML form tag. |
java.lang.String |
getTarget()
Returns the target frame for the form response. |
java.lang.String |
getURL()
Returns the ACTION URL address of the server-side form handler. |
boolean |
isUseGet()
Indicates if the GET method is used for sending the form contents to the server. |
boolean |
isUsePost()
Indicates if the POST method is used for sending the form contents to the server. |
void |
removeElement(HTMLTagElement element)
Removes a form element from the HTMLForm. |
void |
removeElementListener(ElementListener listener)
Removes this ElementListener from the internal list. |
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes the VetoableChangeListener from the internal list. |
void |
setDirection(java.lang.String dir)
Sets the direction of the text interpretation. |
void |
setHiddenParameterList(java.util.Properties parameterList)
Sets the form's hidden parameter list. |
void |
setLanguage(java.lang.String lang)
Sets the language of the input tag. |
void |
setMethod(int method)
Sets the HTTP method used to send form contents to the server. |
void |
setTarget(java.lang.String target)
Sets the target frame for the form response. |
void |
setURL(java.lang.String url)
Sets the ACTION URL address of the server-side form handler. |
java.lang.String |
toString()
Returns the HTMLForm tag as a String. |
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 |
Field Detail |
public static final int METHOD_GET
public static final int METHOD_POST
Constructor Detail |
public HTMLForm()
public HTMLForm(java.lang.String url)
url
- The URL address.Method Detail |
public void addElement(HTMLTagElement element)
element
- The form element.public void addElementListener(ElementListener listener)
listener
- The ElementListener.removeElementListener(com.ibm.as400.util.html.ElementListener)
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The VetoableChangeListener.removeVetoableChangeListener(java.beans.VetoableChangeListener)
public java.lang.String getDirection()
public java.util.Properties getHiddenParameterList()
public java.lang.String getLanguage()
public int getMethod()
public java.lang.String getTag()
public java.lang.String getTarget()
HTMLConstants
public java.lang.String getURL()
public boolean isUseGet()
public boolean isUsePost()
public void removeElement(HTMLTagElement element)
element
- The form element.public void removeElementListener(ElementListener listener)
listener
- The ElementListener.addElementListener(com.ibm.as400.util.html.ElementListener)
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The VetoableChangeListener.addVetoableChangeListener(java.beans.VetoableChangeListener)
public void setDirection(java.lang.String dir) throws java.beans.PropertyVetoException
dir
- The direction. One of the following constants
defined in HTMLConstants: LTR or RTL.java.beans.PropertyVetoException
- If a change is vetoed.HTMLConstants
public void setHiddenParameterList(java.util.Properties parameterList) throws java.beans.PropertyVetoException
parameterList
- The parameter list.java.beans.PropertyVetoException
- If a change is vetoed.public void setLanguage(java.lang.String lang) throws java.beans.PropertyVetoException
lang
- The language. Example language tags include:
en and en-US.java.beans.PropertyVetoException
- If a change is vetoed.public void setMethod(int method) throws java.beans.PropertyVetoException
method
- The method.java.beans.PropertyVetoException
- If a change is vetoed.public void setTarget(java.lang.String target) throws java.beans.PropertyVetoException
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.java.beans.PropertyVetoException
- If a change is vetoed.HTMLConstants
public void setURL(java.lang.String url) throws java.beans.PropertyVetoException
url
- The URL address.java.beans.PropertyVetoException
- If a change is vetoed.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |