CommandButton |
||||
Developer’s Guide Home
Installation and Configuration Common Concepts Components Index Border Layout Panel Calendar Chart Command Button Command Link Composite Filter Confirmation Data Table Date Chooser Day Table Drop Down Field Dynamic Image Folding Panel For Each Graphic Text Hint Label Input Text Input Textarea Layered Pane Level Indicator Popup Layer Popup Menu Select Boolean Checkbox Select Many Checkbox Select One Radio Spinner Suggestion Field Tabbed Pane Tab Set Tree Table Two List Selection Window Focus Load Bundle Scroll Position Ajax Framework Validation Framework Tag Reference API Reference |
Key Features
General InformationThe <o:commandButton> component is API-compatible with the standard <h:commandButton> component and if no extended options are specified it behaves in the same way as its standard analog. You can turn on the Ajax mode and configure the button to reload the specified set of components instead of reloading the whole page by specifying its render attribute. This attribute is specified as a space-separated list of component Ids in the same way as the render attribute of the Ajax component. Specifying this attribute will also make action and/or actionListener specified for the button to be executed during the Ajax request as well. If the Ajax mode is turned on for the button it doesn't submit data for form's components for processing on the server by default, so if you'd like to include some particular components into the Ajax request, for their data to be available during action execution or be saved through bindings, you can specify the execute attribute. Like the action attribute, this attribute is specified as a space-delimited list of component Ids in the same way as for the Ajax component. Here's a simple example: <h:inputText id="firstName" value="#{MyBean.firstName}"/> <h:inputText id="lastName" value="#{MyBean.lastName}"/> <o:commandButton value="Execute" execute="firstName lastName" action="#{MyBean.processName}" render="fullName"/> <h:outputText id="fullName" value="#{MyBean.fullName}"/> When in the Ajax mode, CommandButton provides the Ajax request lifecycle notifications through its onajaxstart, onajaxend, and onerror events. As opposed to the standard <h:commandButton> component, which resticts the values of its type attribute to "submit" and "reset", the <o:commandButton> component allows specifying an additional "button" value which is one of the standard HTML button types and it allows turning off automatic form submission when the button is pressed. Specifying Complex Button ContentYou can specify the content displayed in the button in two ways:
When both the value attribute and child components are specified, the content specified with the child components is displayed. Here's a simple example that demonstrates displaying an image besides the text in a button: <o:commandButton action="#{MyBean.search}" ...> <h:graphicImage url="searchIcon.gif"/> <h:outputText value="Search"/> </o:commandButton> |
|||
© 2010 TeamDev Ltd. | ![]() |