|
|||||||||
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 * @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 HtmlBaseTag |
---|
JAVASCRIPT_STATUS |
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 IHtmlIdWriter |
---|
ID_PARAMETER_NAME, ID_PREFIX, ID_REQUEST_ATTRIBUTE |
Fields inherited from interface HtmlConstants |
---|
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH |
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)
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. |
void |
generateRealName()
|
String |
getAction()
Return the action of the Form. |
String |
getBeanName()
Return the name of the form bean corresponding to this tag. |
String |
getNextId()
Return the next id |
String |
getRealName()
this is used to |
protected AbstractHtmlState |
getState()
This method will return the state associated with the tag. |
String |
getTagName()
Return the name of the Tag. |
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 |
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 when submitting this form. |
void |
setName(String name)
Set the attribute key under which our associated bean is stored. |
void |
setOnReset(String onReset)
Sets the onReset javascript event. |
void |
setOnSubmit(String onSubmit)
Sets the onSubmit javascript event. |
void |
setScope(String scope)
Sets the scope (request or session) under which the associated bean is stored. |
void |
setTarget(String target)
Sets the window target. |
void |
setType(String type)
Sets the Java class name of the bean to be created, if necessary. |
void |
writeId(String id,
String expression)
This method will add a id and expression to the map maintained by the implementor. |
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 getRealName()
public void generateRealName()
public void setFocus(String focus)
focus
- - the focus field name.public void setLocation(String location)
location
- - the location hashpublic void setMethod(String method) throws JspException
method
- - the request method
JspException
public void setName(String name) throws JspException
name
- - the attribute key name
JspException
public void setOnReset(String onReset)
onReset
- - the onReset event.public void setOnSubmit(String onSubmit)
onSubmit
- - the onReset event.public void setScope(String scope) throws JspException
scope
- - the scope.
JspException
public void setTarget(String target)
target
- - the window target.public void setType(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) throws JspException
addParameter
in interface URLParams
name
- - the name of the parameter to be added.value
- - the value of the parameter to be added (a String or String[]).
JspException
public void addTagID(String tagID, String name)
tagID
- - the tagID of a child tag.name
- - the name of a child tag.public String getBeanName()
public void writeId(String id, String expression)
writeId
in interface IHtmlIdWriter
id
- expression
- public String getNextId()
getNextId
in interface IHtmlIdWriter
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 |