ArticlesTutorialsInterview Questions & AnswersCertificationsFree Books & Sample ChaptersTechnical Discussions  Your Account | Advertise with us | Feedback |
Few pages of this site are under construction and we are constantly trying to improve it. If you have any suggestions or ideas about how to improve the site, please Let us know.
JSF tag reference - h:commandButton

« h:column JSF Tag Home h:commandLink »

<h:commandButton>

Contents
  1. Description
  2. Example
  3. Tag Attributes
  4. Code Generator


h:commandButton Description

The commandButton tag renders an HTML submit button that can be associated with a backing bean or ActionListener class for event handling purposes. The button's lable is specified by the value attribute or Image URL. The display value of the button can also be obtained from a message bundle to support internationalization (I18N).

  • Use <h:commandButton> tag to represent a submit button to POST form data to the server.
  • The generated HTML uses <input type = “submit”> syntax.
  • The value attribute specifies the button label.
  • The image attribute specifies URL of an image that renders in place of the button.
  • Setting type = “reset” makes the button a reset button.
  • Use the action attribute to associate the button with a JavaBean’s method.
  • Also see h:commandLink » .



h:commandButton Example


<h:commandButton id="login" value="Login" 
action="#{courseBean.submit}"/>
<h:commandButton id="signUp"  image="../images/btn.jpg"  
action="#{courseBean.submit}"/>

h:commandButton Attributes


Attribute Description Type
id
The unique identifier value for this component. The value must be unique within the closest naming container (e.g.,h:form or f:subview).This value must be a static value.
String
binding
The value-binding expression linking this component tag to a backing bean property.
String
rendered
A boolean value that indicates whether this component should be rendered.Default value: true.
String
action
A method binding EL expression that identifies an action method to be invoked if this component is activated by the user. An action method must be a public method with no parameters that returns a String,called the action outcome, that identifies the next view displayed. The phase that this event is fired in can be controlled via the immediate attribute.
String
actionListener
The actionListener attribute accepts a method-binding expression for a backing bean action listener method that will be notified when this component is activated by the user. An action listener method must be a public method with an javax.faces.event.ActionEvent parameter and a void return type.The phase that this event is fired in can be controlled via the immediate attribute.
String
immediate
A boolean value that identifies the phase during which action events should fire. During normal event processing, action methods and action listener methods are fired during the "invoke application" phase of request processing. If this attribute is set to "true", these methods are fired instead at the end of the "apply request values" phase.
String
value
The value attribute sets the current value for this component.
String
dir
The dir attribute is a standard HTML attribute that overrides the default text directionality for this component. The values accepted for this component are "LTR" (left-to-right) and "RTL" (right-to-left).
String
lang
Code describing the language used in the generated markup for this component
String
style
The style attribute sets the CSS style definition to be applied to this component when it is rendered.
String
title
An advisory title for this element. Often used by the user agent as a tooltip.
String
styleClass
The styleClass attribute sets the CSS class to apply to this component when it is rendered.
String
onclick
Sets the JavaScript code to execute when the mouse pointer is clicked over this element.
String
ondblclick
Sets the JavaScript code to execute when the mouse pointer is double-clicked over this element.
String
onmousedown
Sets the JavaScript code to execute when the mouse pointer is pressed down over this element.
String
onmouseup
Sets the JavaScript code to execute when the mouse button is released over this element.
String
onmouseover
Sets the JavaScript code to execute when the mouse pointer is moved onto this element.
String
onmousemove
Sets the JavaScript code to execute when the mouse pointer is moved within this element.
String
onmouseout
Sets the JavaScript code to execute when the mouse pointer is moved away from this element.
String
onkeypress
Sets the Javascript code to execute when a key is pressed and released over this element.
String
onkeydown
Sets the Javascript code to execute when a key is pressed down over this element.
String
onkeyup
Sets the Javascript code to execute when a key is released over this element.
String
onblur
Sets the Javascript code to execute when this element loses focus.
String
onfocus
Sets the Javascript code to execute when this element receives focus.
String
onselect
Sets the Javascript code to execute when text within this element is selected by the user.
String
onchange
Sets the Javascript code to execute when this element loses focus and its value has been modified since gaining focus.
String
accesskey
The accesskey attribute is a standard HTML attribute that sets the access key that transfers focus to this element when pressed.
String
alt
The alt attribute is a standard HTML attribute that sets the alternate textual description rendered by this component.
String
disabled
When true, this element cannot receive focus.
String
tabindex
The tabindex attribute is a standard HTML attribute that sets the order in which this element receives focus when the user cycles through the elements using the TAB key. The value for this attribute must be an integer between 0 and 32767.
String
type
The type attribute specifies the HTML content type associated with the resource pointed to by this hyperlink.
String
size
The initial width of this control.
String
image
The URL of an image that renders in place of the button.
String
More »» Code Generator
« h:column JSF Tag Home h:commandLink »
Test

  ALSO SEE :

About Us | Our Mission | Terms of use | Author Terms |    Search        | Contact Us | Advertise With Us | Link to Us | Sitemap
Copyright © 2016 developersBOOK.COM. All rights reserved.