it.eng.spago.taglib.html
Class FormTag

java.lang.Object
  extended by TagSupport
      extended by it.eng.spago.taglib.html.FormTag

public class FormTag
extends TagSupport

Custom tag that represents an input form, associated with a bean whose properties correspond to the various fields of the form.

Version:
$Rev: 405216 $ $Date: 2006-05-08 16:06:48 -0700 (Mon, 08 May 2006) $

Field Summary
protected  java.lang.String acceptCharset
          The list of character encodings for input data that the server should accept.
protected  java.lang.String action
          The action URL to which this form should be submitted, if any.
protected  java.lang.String enctype
          The content encoding to be used on a POST submit.
protected  java.lang.String focus
          The name of the field to receive focus, if any.
protected  java.lang.String focusIndex
          The index in the focus field array to receive focus.
protected static java.lang.String lineEnd
          The line ending string.
protected static MessageBundleReference messages
          The message resources for this package.
protected  java.lang.String method
          The request method used when submitting this form.
protected  java.lang.String name
          The name of the form.
protected  java.lang.String onreset
          The onReset event script.
protected  java.lang.String onsubmit
          The onSubmit event script.
protected  boolean readonly
          Controls whether child controls should be 'readonly'.
protected  boolean scriptLanguage
          Include language attribute in the focus script's <script> element.
protected  java.lang.String style
          The style attribute associated with this tag.
protected  java.lang.String styleClass
          The style class associated with this tag.
protected  java.lang.String styleId
          The identifier associated with this tag.
protected  java.lang.String target
          The window target.
protected  boolean useTransactionToken
          Controls whether to create a transaction token to avoid duplicate form submissions.
 
Constructor Summary
FormTag()
           
 
Method Summary
 int doEndTag()
          Render the end of this form.
 int doStartTag()
          Render the beginning of this form.
 java.lang.String getAcceptCharset()
          Return the list of character encodings accepted.
 java.lang.String getAction()
          Return the action URL to which this form should be submitted.
 java.lang.String getEnctype()
          Return the content encoding used when submitting this form.
 java.lang.String getFocus()
          Return the focus field name for this form.
 java.lang.String getFocusIndex()
          Returns the focusIndex.
 java.lang.String getMethod()
          Return the request method used when submitting this form.
 java.lang.String getName()
          Return the name of the form bean corresponding to this tag.
 java.lang.String getOnreset()
          Return the onReset event script.
 java.lang.String getOnsubmit()
          Return the onSubmit event script.
 boolean getScriptLanguage()
          Gets whether or not the focus script's <script> element will include the language attribute.
 java.lang.String getStyle()
          Return the style attribute for this tag.
 java.lang.String getStyleClass()
          Return the style class for this tag.
 java.lang.String getStyleId()
          Return the style identifier for this tag.
 java.lang.String getTarget()
          Return the window target.
 boolean getUseTransactionToken()
           
 boolean isDisabled()
          Returns the disabled event handler.
 boolean isReadonly()
          Returns the readonly event handler.
protected  void lookup()
          Look up values for the postbackAction properties if necessary.
 void release()
          Release any acquired resources.
protected  void renderAction(java.lang.StringBuffer results)
          Renders the action attribute
protected  void renderAttribute(java.lang.StringBuffer results, java.lang.String attribute, java.lang.String value)
          Renders attribute="value" if not null
protected  java.lang.String renderFocusJavascript()
          Generates javascript to set the initial focus to the form element given in the tag's "focus" attribute.
protected  java.lang.String renderFormStartElement()
          Generates the opening <form> element with appropriate attributes.
protected  void renderName(java.lang.StringBuffer results)
          Renders the name of the form.
protected  void renderOtherAttributes(java.lang.StringBuffer results)
          'Hook' to enable this tag to be extended and additional attributes added.
protected  java.lang.String renderToken()
          Generates a hidden input field with token information, if any.
 void setAcceptCharset(java.lang.String acceptCharset)
          Set the list of character encodings accepted.
 void setAction(java.lang.String action)
          Set the action URL to which this form should be submitted.
 void setDisabled(boolean disabled)
          Sets the disabled event handler.
 void setEnctype(java.lang.String enctype)
          Set the content encoding used when submitting this form.
 void setFocus(java.lang.String focus)
          Set the focus field name for this form.
 void setFocusIndex(java.lang.String focusIndex)
          Sets the focusIndex.
 void setMethod(java.lang.String method)
          Set the request method used when submitting this form.
 void setName(java.lang.String formName)
          Set the name of the form.
 void setOnreset(java.lang.String onReset)
          Set the onReset event script.
 void setOnsubmit(java.lang.String onSubmit)
          Set the onSubmit event script.
 void setReadonly(boolean readonly)
          Sets the readonly event handler.
 void setScriptLanguage(boolean scriptLanguage)
          Sets whether or not the focus script's <script> element will include the language attribute.
 void setStyle(java.lang.String style)
          Set the style attribute for this tag.
 void setStyleClass(java.lang.String styleClass)
          Set the style class for this tag.
 void setStyleId(java.lang.String styleId)
          Set the style identifier for this tag.
 void setTarget(java.lang.String target)
          Set the window target.
 void setUseTransactionToken(boolean useTransactionToken)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineEnd

protected static java.lang.String lineEnd
The line ending string.


messages

protected static MessageBundleReference messages
The message resources for this package.


action

protected java.lang.String action
The action URL to which this form should be submitted, if any.


enctype

protected java.lang.String enctype
The content encoding to be used on a POST submit.


focus

protected java.lang.String focus
The name of the field to receive focus, if any.


focusIndex

protected java.lang.String focusIndex
The index in the focus field array to receive focus. This only applies if the field given in the focus attribute is actually an array of fields. This allows a specific field in a radio button array to receive focus while still allowing indexed field names like "myRadioButtonField[1]" to be passed in the focus attribute.

Since:
Struts 1.1

method

protected java.lang.String method
The request method used when submitting this form.


onreset

protected java.lang.String onreset
The onReset event script.


onsubmit

protected java.lang.String onsubmit
The onSubmit event script.


scriptLanguage

protected boolean scriptLanguage
Include language attribute in the focus script's <script> element. This property is ignored in XHTML mode.

Since:
Struts 1.2

style

protected java.lang.String style
The style attribute associated with this tag.


styleClass

protected java.lang.String styleClass
The style class associated with this tag.


styleId

protected java.lang.String styleId
The identifier associated with this tag.


target

protected java.lang.String target
The window target.


name

protected java.lang.String name
The name of the form.


acceptCharset

protected java.lang.String acceptCharset
The list of character encodings for input data that the server should accept.


readonly

protected boolean readonly
Controls whether child controls should be 'readonly'.


useTransactionToken

protected boolean useTransactionToken
Controls whether to create a transaction token to avoid duplicate form submissions.

Constructor Detail

FormTag

public FormTag()
Method Detail

getName

public java.lang.String getName()
Return the name of the form bean corresponding to this tag. There is no corresponding setter method.


setName

public void setName(java.lang.String formName)
Set the name of the form.

Parameters:
formName - Name of the form

getAction

public java.lang.String getAction()
Return the action URL to which this form should be submitted.


setAction

public void setAction(java.lang.String action)
Set the action URL to which this form should be submitted.

Parameters:
action - The new action URL

getEnctype

public java.lang.String getEnctype()
Return the content encoding used when submitting this form.


setEnctype

public void setEnctype(java.lang.String enctype)
Set the content encoding used when submitting this form.

Parameters:
enctype - The new content encoding

getFocus

public java.lang.String getFocus()
Return the focus field name for this form.


setFocus

public void setFocus(java.lang.String focus)
Set the focus field name for this form.

Parameters:
focus - The new focus field name

getMethod

public java.lang.String getMethod()
Return the request method used when submitting this form.


setMethod

public void setMethod(java.lang.String method)
Set the request method used when submitting this form.

Parameters:
method - The new request method

getOnreset

public java.lang.String getOnreset()
Return the onReset event script.


setOnreset

public void setOnreset(java.lang.String onReset)
Set the onReset event script.

Parameters:
onReset - The new event script

getOnsubmit

public java.lang.String getOnsubmit()
Return the onSubmit event script.


setOnsubmit

public void setOnsubmit(java.lang.String onSubmit)
Set the onSubmit event script.

Parameters:
onSubmit - The new event script

getStyle

public java.lang.String getStyle()
Return the style attribute for this tag.


setStyle

public void setStyle(java.lang.String style)
Set the style attribute for this tag.

Parameters:
style - The new style attribute

getStyleClass

public java.lang.String getStyleClass()
Return the style class for this tag.


setStyleClass

public void setStyleClass(java.lang.String styleClass)
Set the style class for this tag.

Parameters:
styleClass - The new style class

getStyleId

public java.lang.String getStyleId()
Return the style identifier for this tag.


setStyleId

public void setStyleId(java.lang.String styleId)
Set the style identifier for this tag.

Parameters:
styleId - The new style identifier

getTarget

public java.lang.String getTarget()
Return the window target.


setTarget

public void setTarget(java.lang.String target)
Set the window target.

Parameters:
target - The new window target

getAcceptCharset

public java.lang.String getAcceptCharset()
Return the list of character encodings accepted.


setAcceptCharset

public void setAcceptCharset(java.lang.String acceptCharset)
Set the list of character encodings accepted.

Parameters:
acceptCharset - The list of character encodings

setDisabled

public void setDisabled(boolean disabled)
Sets the disabled event handler.


isDisabled

public boolean isDisabled()
Returns the disabled event handler.


setReadonly

public void setReadonly(boolean readonly)
Sets the readonly event handler.


isReadonly

public boolean isReadonly()
Returns the readonly event handler.


getUseTransactionToken

public boolean getUseTransactionToken()
Returns:
the useTransactionToken

setUseTransactionToken

public void setUseTransactionToken(boolean useTransactionToken)
Parameters:
useTransactionToken - the useTransactionToken to set

doStartTag

public int doStartTag()
               throws JspException
Render the beginning of this form.

Throws:
JspException - if a JSP exception has occurred

renderFormStartElement

protected java.lang.String renderFormStartElement()
                                           throws JspException
Generates the opening <form> element with appropriate attributes.

Throws:
JspException
Since:
Struts 1.1

renderName

protected void renderName(java.lang.StringBuffer results)
                   throws JspException
Renders the name of the form. If XHTML is set to true, the name will be rendered as an 'id' attribute, otherwise as a 'name' attribute.

Throws:
JspException

renderAction

protected void renderAction(java.lang.StringBuffer results)
Renders the action attribute


renderOtherAttributes

protected void renderOtherAttributes(java.lang.StringBuffer results)
'Hook' to enable this tag to be extended and additional attributes added.


renderToken

protected java.lang.String renderToken()
Generates a hidden input field with token information, if any. The field is added within a div element for HTML 4.01 Strict compliance.

Returns:
A hidden input field containing the token.
Since:
Struts 1.1

renderAttribute

protected void renderAttribute(java.lang.StringBuffer results,
                               java.lang.String attribute,
                               java.lang.String value)
Renders attribute="value" if not null


doEndTag

public int doEndTag()
             throws JspException
Render the end of this form.

Throws:
JspException - if a JSP exception has occurred

renderFocusJavascript

protected java.lang.String renderFocusJavascript()
Generates javascript to set the initial focus to the form element given in the tag's "focus" attribute.

Since:
Struts 1.1

release

public void release()
Release any acquired resources.


lookup

protected void lookup()
               throws JspException
Look up values for the postbackAction properties if necessary.

Throws:
JspException - if a required value cannot be looked up

getFocusIndex

public java.lang.String getFocusIndex()
Returns the focusIndex.

Returns:
String

setFocusIndex

public void setFocusIndex(java.lang.String focusIndex)
Sets the focusIndex.

Parameters:
focusIndex - The focusIndex to set

getScriptLanguage

public boolean getScriptLanguage()
Gets whether or not the focus script's <script> element will include the language attribute.

Returns:
true if language attribute will be included.
Since:
Struts 1.2

setScriptLanguage

public void setScriptLanguage(boolean scriptLanguage)
Sets whether or not the focus script's <script> element will include the language attribute.

Since:
Struts 1.2