|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.jsp.tagext.TagSupport org.springframework.web.servlet.tags.RequestContextAwareTag org.springframework.web.servlet.tags.HtmlEscapingAwareTag org.springframework.web.servlet.tags.form.AbstractFormTag org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag org.springframework.web.servlet.tags.form.AbstractHtmlElementTag org.springframework.web.servlet.tags.form.FormTag
public class FormTag
Data-binding aware JSP tag for rendering an HTML 'form
' whose
inner elements are bound to properties on a
command object
.
Users should place the command object into the
ModelAndView
when populating the
data for their view. The name of this command object can be configured
using the commandName
property.
The default value for the commandName
property
is 'command
' which corresponds to the default name when using
the SimpleFormController
.
Inner tags can access the name of the command object via the
PageContext
. The attribute name is defined in
COMMAND_NAME_VARIABLE_NAME
.
SimpleFormController
,
Serialized FormField Summary | |
---|---|
static String |
ACTION_ATTRIBUTE
The name of the ' action ' attribute. |
static String |
COMMAND_NAME_ATTRIBUTE
The name of the ' commandName ' attribute. |
static String |
COMMAND_NAME_VARIABLE_NAME
The name of the PageContext attribute under which the
command object name is exposed. |
static String |
DEFAULT_COMMAND_NAME
The default command object name: "command". |
static String |
ENCTYPE_ATTRIBUTE
The name of the ' enctype ' attribute. |
static String |
METHOD_ATTRIBUTE
The name of the ' method ' attribute. |
static String |
NAME_ATTRIBUTE
The name of the ' name ' attribute. |
static String |
ONRESET_ATTRIBUTE
The name of the ' onreset ' attribute. |
static String |
ONSUBMIT_ATTRIBUTE
The name of the ' onsubmit ' attribute. |
Fields inherited from class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag |
---|
CLASS_ATTRIBUTE, DIR_ATTRIBUTE, LANG_ATTRIBUTE, ONCLICK_ATTRIBUTE, ONDBLCLICK_ATTRIBUTE, ONKEYDOWN_ATTRIBUTE, ONKEYPRESS_ATTRIBUTE, ONKEYUP_ATTRIBUTE, ONMOUSEDOWN_ATTRIBUTE, ONMOUSEMOVE_ATTRIBUTE, ONMOUSEOUT_ATTRIBUTE, ONMOUSEOVER_ATTRIBUTE, ONMOUSEUP_ATTRIBUTE, STYLE_ATTRIBUTE, TABINDEX_ATTRIBUTE, TITLE_ATTRIBUTE |
Fields inherited from class org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag |
---|
ID_ATTRIBUTE |
Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag |
---|
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
pageContext |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
---|
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Constructor Summary | |
---|---|
FormTag()
|
Method Summary | |
---|---|
protected String |
autogenerateId()
Autogenerated IDs correspond to the command name. |
int |
doEndTag()
Closes the ' form ' block tag and removes the command name
from the PageContext . |
void |
doFinally()
Clears the stored TagWriter . |
protected String |
getAction()
Gets the value of the ' action ' attribute. |
protected String |
getCommandName()
Gets the value of the ' commandName ' attribute. |
protected String |
getEnctype()
Gets the value of the ' enctype ' attribute. |
protected String |
getMethod()
Gets the value of the ' method ' attribute. |
protected String |
getName()
Name is not a valid attribute for form on XHTML 1.0. |
protected String |
getOnreset()
Gets the value of the ' onreset ' attribute. |
protected String |
getOnsubmit()
Gets the value of the ' onsubmit ' attribute. |
protected String |
resolveCommandName()
Resolves and returns the name of the command object. |
protected String |
resolveCssClass()
Override resolve CSS class since error class is not supported. |
void |
setAction(String action)
Sets the value of the ' action ' attribute. |
void |
setCommandName(String commandName)
Sets the name of the command object. |
void |
setCssErrorClass(String cssErrorClass)
Unsupported for forms. |
void |
setEnctype(String enctype)
Sets the value of the ' enctype ' attribute. |
void |
setMethod(String method)
Sets the value of the ' method ' attribute. |
void |
setName(String name)
Sets the value of the ' name ' attribute. |
void |
setOnreset(String onreset)
Sets the value of the ' onreset ' attribute. |
void |
setOnsubmit(String onsubmit)
Sets the value of the ' onsubmit ' attribute. |
void |
setPath(String path)
Unsupported for forms. |
protected int |
writeTagContent(TagWriter tagWriter)
Writes the opening part of the block ' form ' tag and exposes
the command name in the PageContext . |
Methods inherited from class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag |
---|
getCssClass, getCssErrorClass, getCssStyle, getDir, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getTabindex, getTitle, setCssClass, setCssStyle, setDir, setLang, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setTabindex, setTitle, writeDefaultAttributes |
Methods inherited from class org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag |
---|
getBindStatus, getBoundValue, getId, getNestedPath, getPath, getPropertyEditor, setId |
Methods inherited from class org.springframework.web.servlet.tags.form.AbstractFormTag |
---|
createTagWriter, doStartTagInternal, evaluate, getDisplayString, getDisplayString, writeOptionalAttribute |
Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag |
---|
isHtmlEscape, setHtmlEscape |
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag |
---|
doCatch, doStartTag, getRequestContext |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
doAfterBody, findAncestorWithClass, getParent, getValue, getValues, release, removeValue, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_COMMAND_NAME
public static final String COMMAND_NAME_ATTRIBUTE
commandName
' attribute.
public static final String COMMAND_NAME_VARIABLE_NAME
PageContext
attribute under which the
command object name is exposed.
public static final String NAME_ATTRIBUTE
name
' attribute.
public static final String ONSUBMIT_ATTRIBUTE
onsubmit
' attribute.
public static final String ONRESET_ATTRIBUTE
onreset
' attribute.
public static final String METHOD_ATTRIBUTE
method
' attribute.
public static final String ACTION_ATTRIBUTE
action
' attribute.
public static final String ENCTYPE_ATTRIBUTE
enctype
' attribute.
Constructor Detail |
---|
public FormTag()
Method Detail |
---|
public void setCommandName(String commandName)
May be a runtime expression.
commandName
- the name of the command object
IllegalArgumentException
- if the supplied name is null
protected String getCommandName()
commandName
' attribute.
May be a runtime expression.
public void setName(String name)
name
' attribute.
May be a runtime expression.
public void setAction(String action)
action
' attribute.
May be a runtime expression.
protected String getAction()
action
' attribute.
May be a runtime expression.
public void setMethod(String method)
method
' attribute.
May be a runtime expression.
protected String getMethod()
method
' attribute.
May be a runtime expression.
public void setEnctype(String enctype)
enctype
' attribute.
May be a runtime expression.
protected String getEnctype()
enctype
' attribute.
May be a runtime expression.
public void setOnsubmit(String onsubmit)
onsubmit
' attribute.
May be a runtime expression.
protected String getOnsubmit()
onsubmit
' attribute.
May be a runtime expression.
public void setOnreset(String onreset)
onreset
' attribute.
May be a runtime expression.
protected String getOnreset()
onreset
' attribute.
May be a runtime expression.
protected int writeTagContent(TagWriter tagWriter) throws JspException
form
' tag and exposes
the command name in the PageContext
.
writeTagContent
in class AbstractFormTag
tagWriter
- the TagWriter
to which the form content is to be written
Tag.EVAL_BODY_INCLUDE
JspException
protected String getName() throws JspException
getName
in class AbstractDataBoundFormElementTag
name
' attribute
JspException
protected String autogenerateId() throws JspException
autogenerateId
in class AbstractDataBoundFormElementTag
JspException
protected String resolveCommandName() throws JspException
Resolves
and returns the name of the command object.
IllegalArgumentException
- if the command object resolves to null
JspException
public int doEndTag() throws JspException
form
' block tag and removes the command name
from the PageContext
.
doEndTag
in interface Tag
doEndTag
in class TagSupport
JspException
protected String resolveCssClass() throws JspException
resolveCssClass
in class AbstractHtmlElementTag
JspException
public void doFinally()
TagWriter
.
doFinally
in interface TryCatchFinally
doFinally
in class AbstractDataBoundFormElementTag
public void setPath(String path)
setPath
in class AbstractDataBoundFormElementTag
UnsupportedOperationException
- alwayspublic void setCssErrorClass(String cssErrorClass)
setCssErrorClass
in class AbstractHtmlElementTag
UnsupportedOperationException
- always
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |