org.apache.wicket.markup.html.form
Class StatelessForm<T>

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.form.Form<T>
                  extended by org.apache.wicket.markup.html.form.StatelessForm<T>
Type Parameters:
T - The type of the Form's model object
All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IConverterLocator, IGenericComponent<T>, IRequestListener, IFormSubmitListener, IHeaderContributor, IRequestableComponent, IHierarchical<Component>, IClusterable

public class StatelessForm<T>
extends Form<T>

This StatelessForm is the same as a normal form but with the statelesshint default to true. The form can be newly constructed when the onSubmit of its form or its buttons is called. So you can't depend on state within the page. The only state you can depend on is what was submitted from the browser. So the model of the form or the formcomponents are updated with the submit values.

Author:
jcompagner
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.markup.html.form.Form
Form.MethodMismatchResponse, Form.ValidationVisitor
 
Field Summary
 
Fields inherited from class org.apache.wicket.markup.html.form.Form
ENCTYPE_MULTIPART_FORM_DATA, METHOD_GET, METHOD_POST
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Fields inherited from interface org.apache.wicket.markup.html.form.IFormSubmitListener
INTERFACE
 
Constructor Summary
StatelessForm(String id)
          Construct.
StatelessForm(String id, IModel<T> model)
          Construct.
 
Method Summary
protected  CharSequence getActionUrl()
          Generates the action url for the form
protected  boolean getStatelessHint()
          Returns whether the component can be stateless.
protected  Form.MethodMismatchResponse onMethodMismatch()
          Called when a form has been submitted using a method differing from return value of Form.getMethod().
 void process(IFormSubmitter submittingComponent)
          Remove the page parameters for all form component otherwise they get appended to action URL Process the form.
 
Methods inherited from class org.apache.wicket.markup.html.form.Form
add, appendDefaultButtonField, beforeUpdateFormComponentModels, callOnError, clearInput, delegateSubmit, encodeUrlInHiddenFields, error, findForm, findSubmittingButton, getDefaultButton, getFormValidators, getHiddenFieldId, getInputNamePrefix, getJsForInterfaceUrl, getMaxSize, getMethod, getModel, getModelObject, getRootForm, getRootFormRelativeId, getValidatorKeyPrefix, handleMultiPart, hasError, internalOnModelChanged, isMultiPart, isRootForm, isSubmitted, markFormComponentsInvalid, markFormComponentsValid, onBeforeRender, onComponentTag, onComponentTagBody, onDetach, onError, onFileUploadException, onFormSubmitted, onFormSubmitted, onSubmit, onValidate, onValidateModelObjects, registerJavaScriptNamespaces, remove, renderHead, renderPlaceholderTag, setDefaultButton, setMaxSize, setModel, setModelObject, setMultiPart, setVersioned, updateFormComponentModels, validate, validateComponents, validateFormValidator, validateFormValidators, visitFormComponents, visitFormComponentsPostOrder, wantSubmitOnNestedFormSubmit, writeParamsAsHiddenFields
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest, getWebResponse, getWebSession
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onConfigure, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StatelessForm

public StatelessForm(String id)
Construct.

Parameters:
id -

StatelessForm

public StatelessForm(String id,
                     IModel<T> model)
Construct.

Parameters:
id -
model -
Method Detail

getStatelessHint

protected boolean getStatelessHint()
Description copied from class: Component
Returns whether the component can be stateless. Also the component behaviors must be stateless, otherwise the component will be treat as stateful. In order for page to be stateless (and not to be stored in session), all components (and component behaviors) must be stateless.

Overrides:
getStatelessHint in class Form<T>
Returns:
whether the component can be stateless
See Also:
Component.getStatelessHint()

onMethodMismatch

protected Form.MethodMismatchResponse onMethodMismatch()
Description copied from class: Form
Called when a form has been submitted using a method differing from return value of Form.getMethod(). For example, someone can copy and paste the action url and invoke the form using a GET instead of the desired POST. This method allows the user to react to this situation.

Overrides:
onMethodMismatch in class Form<T>
Returns:
response that can either abort or continue the processing of the form

getActionUrl

protected CharSequence getActionUrl()
Description copied from class: Form
Generates the action url for the form

Overrides:
getActionUrl in class Form<T>
Returns:
action url

process

public void process(IFormSubmitter submittingComponent)
Remove the page parameters for all form component otherwise they get appended to action URL Process the form. Though you can override this method to provide your own algorithm, it is not recommended to do so.

See the class documentation for further details on the form processing

Overrides:
process in class Form<T>
Parameters:
submittingComponent - component responsible for submitting the form, or null if none (eg the form has been submitted via the enter key or javascript calling form.onsubmit())
See Also:
for an easy way to process submitting component in the default manner


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.