|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectTagSupport
BodyTagSupport
AbstractClassicTag
HtmlBaseTag
Form
public class Form
This tag represents an input form, associated with a bean whose properties correspond to the various fields of the form.
processData
action method in the Controller file when the form is submitted.
<netui:form action="processData"> Name: <netui:textBox dataSource="actionForm.name"/> Age: <netui:textBox dataSource="actionForm.age"/> <netui:button value="Submit" type="submit"/> </netui:form>
Notice that the processData action method takes a parameter of
type ProcessDataForm
.
@Jpf.Action( forwards={ @Jpf.Forward(name="success", path="showData.jsp") } ) protected Forward processData(ProcessDataForm form) { // // Process the submitted data here. // return new Forward("success"); }
This means that the submitted data is loaded into an instance of ProcessDataForm before it is passed to the action method.
In this next sample, the form fields are pre-populated based upon default values stored in the Session object.
<netui:form action="Action" type="corp.Controller$NameBean" scope="session" name="nameBean"> Name: <netui:textBox dataSource="actionForm.name" /> <netui:button value="Submit"/> </netui:form>
Field Summary |
---|
Fields inherited from class AbstractClassicTag |
---|
DefaultNamingChain, EMPTY_STRING, NETUI_UNIQUE_CNT |
Fields inherited from class BodyTagSupport |
---|
bodyContent |
Fields inherited from class TagSupport |
---|
id, pageContext |
Fields inherited from interface BodyTag |
---|
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface IterationTag |
---|
EVAL_BODY_AGAIN |
Fields inherited from interface Tag |
---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Constructor Summary | |
---|---|
Form()
|
Method Summary | |
---|---|
void |
addParameter(String name,
Object value,
String facet)
Adds a URL parameter to the generated hyperlink. |
void |
addTagID(String tagID,
String name)
Adds a tagId and name to the Form's focusMap. |
int |
doAfterBody()
Save the body content of the Form. |
int |
doEndTag()
Render the end of this form. |
int |
doStartTag()
Render the beginning of this form. |
String |
getAction()
Return the action of the Form. |
String |
getLocation()
Return the value of the location. |
String |
getRealFormId()
This method will return the real id that will be written out by the form. |
protected AbstractHtmlState |
getState()
This method will return the state associated with the tag. |
String |
getTagName()
Return the name of the Tag. |
void |
insureRealId()
This method will insure that a real id is written out even if a tagId is not set for the form. |
boolean |
isFocusSet()
Get the focus flag. |
protected void |
localRelease()
Release any acquired resources. |
void |
setAction(String action)
Set the name of the action for the Form. |
void |
setAttribute(String name,
String value,
String facet)
Base support for the attribute tag. |
void |
setBeanName(String name)
Set the attribute key under which our associated bean is stored. |
void |
setBeanScope(String scope)
Sets the scope (request or session) under which the associated bean is stored. |
void |
setBeanType(String type)
Sets the Java class name of the bean to be created, if necessary. |
void |
setEnctype(String enctype)
Set the content encoding to be used on a post submit. |
void |
setFocus(String focus)
Set the name of the field to receive focus. |
void |
setGenJavaScriptFormSubmit(boolean formSubmit)
Generate the JavaScript which will submit a form. |
void |
setLocation(String location)
Set the location hash to append to the url. |
void |
setMethod(String method)
Set the request method used ("get" or "post") when submitting this form. |
void |
setOnReset(String onReset)
Sets the onReset javascript event. |
void |
setOnSubmit(String onSubmit)
Sets the onSubmit javascript event. |
void |
setTarget(String target)
Sets the window target. |
void |
setTargetScope(String targetScope)
Set the target "scope" for the form's action. |
Methods inherited from class HtmlBaseTag |
---|
getJavaScriptAttribute, getOnClick, getTagId, renderDefaultNameAndId, renderNameAndId, setDir, setLang, setOnClick, setOnDblClick, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setStateAttribute, setStyle, setStyleClass, setTagId, setTitle |
Methods inherited from class BodyTagSupport |
---|
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent |
Methods inherited from class TagSupport |
---|
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface Tag |
---|
getParent, setPageContext, setParent |
Constructor Detail |
---|
public Form()
Method Detail |
---|
public String getTagName()
getTagName
in interface INetuiTag
getTagName
in class AbstractClassicTag
protected AbstractHtmlState getState()
getState
in class HtmlBaseTag
AbstractHtmlState
class.public void setAttribute(String name, String value, String facet) throws JspException
action
,
and method
attributes.
setAttribute
in interface IAttributeConsumer
setAttribute
in class HtmlBaseTag
name
- The name of the attribute. This value may not be null or the empty string.value
- The value of the attribute. This may contain an expression.facet
- The name of a facet to which the attribute will be applied. This is optional.
JspException
- A JspException may be thrown if there is an error setting the attribute.public String getAction()
public void setAction(String action) throws JspException
action
- the name of the action to set for the Form.
JspException
public void setEnctype(String enctype)
enctype
- the content encoding type.public String getRealFormId()
public void insureRealId()
public void setFocus(String focus)
focus
- the focus field name.public boolean isFocusSet()
true
if the focus has been set. false
otherwise.public void setLocation(String location)
location
- the location hashpublic String getLocation()
public void setMethod(String method) throws JspException
method
- the request method
JspException
public void setBeanName(String name) throws JspException
name
- the attribute key name
JspException
public void setTargetScope(String targetScope)
targetScope
- the name of the target scope in which the associated action's page flow resides.public void setOnReset(String onReset)
onReset
- the onReset event.public void setOnSubmit(String onSubmit)
onSubmit
- the onReset event.public void setBeanScope(String scope) throws JspException
scope
- the scope.
JspException
public void setTarget(String target)
target
- the window target.public void setBeanType(String type) throws JspException
type
- the class name
JspException
public void setGenJavaScriptFormSubmit(boolean formSubmit)
formSubmit
- boolean value indicating that the form submit JavaScript should be generated. Default is false.public void addParameter(String name, Object value, String facet) throws JspException
addParameter
in interface IUrlParams
name
- the name of the parameter to be added.value
- the value of the parameter to be added (a String or String[]).facet
-
JspException
public void addTagID(String tagID, String name)
tagID
- the tagID of a child tag.name
- the name of a child tag.public int doStartTag() throws JspException
doStartTag
in interface Tag
doStartTag
in class BodyTagSupport
JspException
- if a JSP exception has occurredpublic int doAfterBody() throws JspException
doAfterBody
in interface IterationTag
doAfterBody
in class BodyTagSupport
JspException
- if a JSP exception has occurredpublic int doEndTag() throws JspException
doEndTag
in interface Tag
doEndTag
in class BodyTagSupport
JspException
- if a JSP exception has occurredprotected void localRelease()
localRelease
in class HtmlBaseTag
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |