- java.lang.Object
- 
- jakarta.faces.component.UIComponent
- 
- jakarta.faces.component.UIComponentBase
- 
- jakarta.faces.component.UIForm
- 
- jakarta.faces.component.html.HtmlForm
- 
- org.omnifaces.component.input.Form
 
 
 
 
 
- 
- All Implemented Interfaces:
- ClientBehaviorHolder,- NamingContainer,- PartialStateHolder,- StateHolder,- TransientStateHolder,- UniqueIdVendor,- ComponentSystemEventListener,- FacesListener,- SystemEventListenerHolder,- EventListener
 
 public class Form extends HtmlForm The <o:form>is a component that extends the standard<h:form>and submits to exactly the request URI with query string as seen in browser's address. Standard Faces<h:form>submits to the view ID and does not include any query string parameters or path parameters and may therefore fail in cases when the form is submitted to a request scoped bean which relies on the same initial query string parameters or path parameters still being present in the request URI. This is particularly useful if you're using FacesViews or forwarding everything to 1 page.Additionally, it offers in combination with the <o:ignoreValidationFailed>tag on anUICommandcomponent the possibility to ignore validation failures so that the invoke action phase will be executed anyway.Since version 2.1 this component also supports adding query string parameters to the action URL via nested <f:param>and<o:param>.Since version 3.0, it will also during ajax requests automatically send only the form data which actually need to be processed as opposed to the entire form, based on the executeattribute of any nested<f:ajax>. This feature is similar topartialSubmitfeature of PrimeFaces. This will reduce the request payload when used in large forms such as editable tables.You can use it the same way as <h:form>, you only need to changeh:too:.Use request URIThis was available since version 1.6, but since version 3.0, this has become enabled by default. So just using <o:form>will already submit to the exact request URI with query string as seen in browser's address bar. In order to turn off this behavior, setuseRequestURIattribute tofalse.<o:form useRequestURI="false"> Include request paramsWhen you want to include request parameters only instead of the entire request URI with query string, set the includeRequestParamsattribute totrue. This will implicitly setuseRequestURIattribute tofalse.<o:form includeRequestParams="true"> Partial submitThis is the default behavior. So just using <o:form>will already cause the<f:ajax>to send only the form data which actually need to be processed. In order to turn off this behavior, setpartialSubmitattribute tofalse.<o:form partialSubmit="false"> Add query string parameters to action URLThe standard UIFormdoesn't support adding query string parameters to the action URL. This component offers this possibility via nested<f:param>and<o:param>.<o:form> <f:param name="somename" value="somevalue" /> ... </o:form>The <f|o:param>will override any included view or request parameters on the same name. To conditionally add or override, use thedisabledattribute of<f|o:param>.The support was added in OmniFaces 2.2. Ignore Validation FailedIn order to properly use the <o:ignoreValidationFailed>tag on anUICommandcomponent, its parent<h:form>component has to be replaced by this<o:form>component. See alsoIgnoreValidationFailed.- Since:
- 1.1
- Author:
- Arjan Tijms, Bauke Scholtz
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringCOMPONENT_TYPEThe component type, which is "org.omnifaces.component.input.Form".- 
Fields inherited from class jakarta.faces.component.UIFormCOMPONENT_FAMILY
 - 
Fields inherited from class jakarta.faces.component.UIComponentATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY
 - 
Fields inherited from interface jakarta.faces.component.NamingContainerSEPARATOR_CHAR
 
- 
 - 
Constructor SummaryConstructors Constructor Description Form()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencodeBegin(FacesContext context)booleanisIgnoreValidationFailed()Returns whether or not the form should ignore validation fail (and thus proceed to update model/invoke action).booleanisIncludeRequestParams()Returns whether or not the request parameters should be encoded into the form's action URL.booleanisPartialSubmit()Returns whether to send only the form data which actually need to be processed as opposed to the entire form.booleanisUseRequestURI()Returns whether the request URI should be used as form's action URL.voidprocessUpdates(FacesContext context)voidprocessValidators(FacesContext context)voidsetIgnoreValidationFailed(boolean ignoreValidationFailed)Set whether the form should ignore validation fail.voidsetIncludeRequestParams(boolean includeRequestParams)Set whether or not the request parameters should be encoded into the form's action URL.voidsetPartialSubmit(boolean partialSubmit)Set whether to send only the form data which actually need to be processed as opposed to the entire form.voidsetUseRequestURI(boolean useRequestURI)Set whether the request URI should be used as form's action URL.- 
Methods inherited from class jakarta.faces.component.html.HtmlFormgetAccept, getAcceptcharset, getDefaultEventName, getDir, getEnctype, getEventNames, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnreset, getOnsubmit, getRole, getStyle, getStyleClass, getTarget, getTitle, setAccept, setAcceptcharset, setDir, setEnctype, setLang, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnreset, setOnsubmit, setRole, setStyle, setStyleClass, setTarget, setTitle
 - 
Methods inherited from class jakarta.faces.component.UIFormcreateUniqueId, getContainerClientId, getFamily, isPrependId, isSubmitted, processDecodes, setPrependId, setSubmitted, visitTree
 - 
Methods inherited from class jakarta.faces.component.UIComponentBaseaddClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
 - 
Methods inherited from class jakarta.faces.component.UIComponentencodeAll, getClientId, getCompositeComponentParent, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface jakarta.faces.component.behavior.ClientBehaviorHolderaddClientBehavior, getClientBehaviors
 
- 
 
- 
- 
- 
Field Detail- 
COMPONENT_TYPEpublic static final String COMPONENT_TYPE The component type, which is "org.omnifaces.component.input.Form".- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
processValidatorspublic void processValidators(FacesContext context) - Overrides:
- processValidatorsin class- UIForm
 
 - 
processUpdatespublic void processUpdates(FacesContext context) - Overrides:
- processUpdatesin class- UIForm
 
 - 
encodeBeginpublic void encodeBegin(FacesContext context) throws IOException - Overrides:
- encodeBeginin class- UIComponentBase
- Throws:
- IOException
 
 - 
isIncludeRequestParamspublic boolean isIncludeRequestParams() Returns whether or not the request parameters should be encoded into the form's action URL.- Returns:
- Whether or not the request parameters should be encoded into the form's action URL.
- Since:
- 1.5
 
 - 
setIncludeRequestParamspublic void setIncludeRequestParams(boolean includeRequestParams) Set whether or not the request parameters should be encoded into the form's action URL.- Parameters:
- includeRequestParams- Whether or not the request parameters should be encoded into the form's action URL.
- Since:
- 1.5
 
 - 
isUseRequestURIpublic boolean isUseRequestURI() Returns whether the request URI should be used as form's action URL. Defaults totrue. This setting is ignored whenincludeRequestParamsis set totrue.- Returns:
- Whether the request URI should be used as form's action URL.
- Since:
- 1.6
 
 - 
setUseRequestURIpublic void setUseRequestURI(boolean useRequestURI) Set whether the request URI should be used as form's action URL. This setting is ignored whenincludeRequestParamsis set totrue.- Parameters:
- useRequestURI- Whether the request URI should be used as form's action URL.
- Since:
- 1.6
 
 - 
isIgnoreValidationFailedpublic boolean isIgnoreValidationFailed() Returns whether or not the form should ignore validation fail (and thus proceed to update model/invoke action).- Returns:
- Whether or not the form should ignore validation fail.
- Since:
- 2.1
 
 - 
setIgnoreValidationFailedpublic void setIgnoreValidationFailed(boolean ignoreValidationFailed) Set whether the form should ignore validation fail.- Parameters:
- ignoreValidationFailed- Whether the form should ignore validation fail.
- Since:
- 2.1
 
 - 
isPartialSubmitpublic boolean isPartialSubmit() Returns whether to send only the form data which actually need to be processed as opposed to the entire form. Defaults totrue.- Returns:
- Whether to send only the form data which actually need to be processed as opposed to the entire form.
- Since:
- 3.0
 
 - 
setPartialSubmitpublic void setPartialSubmit(boolean partialSubmit) Set whether to send only the form data which actually need to be processed as opposed to the entire form.- Parameters:
- partialSubmit- Whether to send only the form data which actually need to be processed as opposed to the entire form.
- Since:
- 3.0
 
 
- 
 
-