nl.gx.webmanager.taglib
Class FormTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by nl.gx.webmanager.taglib.FormTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag

public class FormTag
extends javax.servlet.jsp.tagext.SimpleTagSupport
implements javax.servlet.jsp.tagext.DynamicAttributes

Implements the < wm:form > tag. Returns an HTML form tag and a (number of) hidden input tags enclosed in it. Additional inputs can be defined in the body of the < wm:form > tag. The < wm:form > tag is a very complicated piece of functionality that is mostly used to render various types of forms such as the poll form, the ecard form, or forms defined in the forms module. All these forms are processed by the FormHandler which runs on the frontend and processes forms submitted by users. This FormHandler expects several inputs in the form. The < wm:form > tag automatically generates these. What exactly is generated, depends on the handle. Currently the following builtin handles are supported in the < wm:form > tag:

Except for the form handle, these are all related to specific GX WebManager features.
Example of usage (1):
 < wm:form handle="search" onSubmit="doSearch();" >
 < input type="text" name="keyword" />
 < /wm:form >
 
The example above displays a search form (handle="search"). A search form should specify a keyword, therefore an input is included to set the keyword (using the HTML input tag). Also some javascript should be executed if the form is submitted. The onSubmit parameter takes care of that.
The rendering of the formparts is delegated using the < wm:render > tag (which is also part of the WebManager tag library). This tag renders the form object of the formelement.
Example of usage (2):
 < wm:form handle="form" onSubmit="return checkForm${formElementId}();" >
 < input name="dummybutton" type="image" value="" alt="" src="${presentationcontext.website.emptyImage}"
  style="position: absolute; border-style: none; padding: 0; spacing: 0; text-indent: 0;" height="0" width="0" />
 < wm:render object="${formElement.form}" />
 < /wm:form >
 
Example of usage (3):
 < wm:form handle="formback" />
 
This prints the back button in a form.


Constructor Summary
FormTag()
           
 
Method Summary
 void doTag()
           
protected  java.lang.String getExtraPassOn()
          Return a comma-separated list of extra parameters to be used in generating the URL in the form or null if it is not set.
protected  java.lang.String getFrame()
          Return frame name or null if it is not set.
protected  java.lang.String getHandle()
          Return the name of the handle that should be used.
protected  java.lang.String getOnSubmit()
          Return the name of the Javascript function to be used in the 'onSubmit=?...?' attribute of the resulting HTML form tag or null if it is not set.
protected  java.lang.String getTarget()
          Return the name of the HTML frame to be used in the 'target=?...?' attribute of the resulting HTML form tag or null if the target attribute is not set.
protected  boolean isWebGuidelinesCompliant()
          Returns webGuidelinesCompliant is requested true or false, false if it is not set.
 void setDynamicAttribute(java.lang.String uri, java.lang.String localName, java.lang.Object value)
           
 void setExtraPassOn(java.lang.String extraPassOn)
          Specifies a comma-separated list of extra parameters to be used in generating the URL in the form.
 void setFrame(java.lang.String frame)
          Setter for optional attribute frame.
 void setHandle(java.lang.String handle)
          Sets the name of the handle that should be used.
 void setOnSubmit(java.lang.String onSubmit)
          Specifies the name of the Javascript function to be used in the 'onSubmit=?...?' attribute of the resulting HTML form tag.
 void setTarget(java.lang.String target)
          Specifies the name of the HTML frame to be used in the 'target=?...?' attribute of the resulting HTML form tag.
 void setWebGuidelinesCompliant(boolean webGuidelinesCompliant)
          Sets the optional attribute webGuidelinesCompliant.
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormTag

public FormTag()
Method Detail

setHandle

public void setHandle(java.lang.String handle)
Sets the name of the handle that should be used. Valid values: see FormTag class description.

Parameters:
handle - the name of the handle that should be used.

getHandle

protected java.lang.String getHandle()
Return the name of the handle that should be used.

Returns:
the name of the handle that should be used.

setDynamicAttribute

public void setDynamicAttribute(java.lang.String uri,
                                java.lang.String localName,
                                java.lang.Object value)
Specified by:
setDynamicAttribute in interface javax.servlet.jsp.tagext.DynamicAttributes

setExtraPassOn

public void setExtraPassOn(java.lang.String extraPassOn)
Specifies a comma-separated list of extra parameters to be used in generating the URL in the form. This is the URL of the page to display when an action is performed in the form. By default the following values are already passed on: contentid,dbid,typeofpage,step,orgurl,cfe,forum

Parameters:
extraPassOn - Comma-separated list of extra passOn-parameters for the URL in the form
See Also:
UrlBuilder

getExtraPassOn

protected java.lang.String getExtraPassOn()
Return a comma-separated list of extra parameters to be used in generating the URL in the form or null if it is not set.

Returns:
extra passon request parameters

setOnSubmit

public void setOnSubmit(java.lang.String onSubmit)
Specifies the name of the Javascript function to be used in the 'onSubmit=?...?' attribute of the resulting HTML form tag. This JS function can be used e.g. to do some error checking on the form data. Default value is empty (no JS function).

Parameters:
onSubmit - javascript function name

getOnSubmit

protected java.lang.String getOnSubmit()
Return the name of the Javascript function to be used in the 'onSubmit=?...?' attribute of the resulting HTML form tag or null if it is not set.

Returns:
onSubmit javascript function name or null if it is not set

setTarget

public void setTarget(java.lang.String target)
Specifies the name of the HTML frame to be used in the 'target=?...?' attribute of the resulting HTML form tag. The response to the form is displayed in the target frame. If the specified frame does not exist, the response is shown in a new window.

Parameters:
target - , for example _self, _blank, _parent, _top or the name of a frame.

getTarget

protected java.lang.String getTarget()
Return the name of the HTML frame to be used in the 'target=?...?' attribute of the resulting HTML form tag or null if the target attribute is not set.

Returns:
target or null if it is not set.

setFrame

public void setFrame(java.lang.String frame)
Setter for optional attribute frame. If a value (e.g. OUTP) for this attribute is specified, an HTML input tag is created as follows in the body of the form tag:
< input type="hidden" name="frame" value="OUTP" />
This attribute may be used in conjunction with the attribute "target" to specify the frame to load in the response to the form.

Parameters:
frame - name of a frame as specified in the layout descriptor

getFrame

protected java.lang.String getFrame()
Return frame name or null if it is not set.

Returns:
frame name or null if it is not set.

setWebGuidelinesCompliant

public final void setWebGuidelinesCompliant(boolean webGuidelinesCompliant)
Sets the optional attribute webGuidelinesCompliant. If a value "true" for this attribute is specified, an HTML button tag is created (in order to meet with Webrichtlijnen article R-pd.13.4). < input type="submit" value="Submit" class="buttonSubmitHidden" />
This attribute only is read if the attribute "handle" equals "formback".

Parameters:
webGuidelinesCompliant - indicates web-guidelines compliance

isWebGuidelinesCompliant

protected final boolean isWebGuidelinesCompliant()
Returns webGuidelinesCompliant is requested true or false, false if it is not set.

Returns:
true or false, false if it is not set.

doTag

public void doTag()
           throws javax.servlet.jsp.JspException,
                  java.io.IOException
Specified by:
doTag in interface javax.servlet.jsp.tagext.SimpleTag
Overrides:
doTag in class javax.servlet.jsp.tagext.SimpleTagSupport
Throws:
javax.servlet.jsp.JspException
java.io.IOException


Copyright © 2007-2011 GX Software BV. All Rights Reserved.