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:commandLink

« h:commandButton JSF Tag Home h:dataTable »

<h:commandLink>

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


h:commandLink Description

The commandLink tag renders an HTML "a" anchor element that acts like a form submit button when clicked.The commandLink tag is used to submit an action event to the application.

  • Use <h:commandLink> tag to represent a link to POST form data.
  • h:commandLink tag must include a nested outputText tag, which represents the text the user clicks to generate the event.
  • The generated HTML uses <a href=”#” onclick=”..someMethod..”> syntax.
  • The commandLink tag will render JavaScript. If you use this tag, make sure your browser is JavaScript-enabled.
  • The onclick attribute is automatically populated with Javascript to submit the form.
  • Setting type = “reset” makes the link a reset button.
  • Use the action attribute to associate the link with a JavaBean’s method.
  • Also see h:commandButton &  t:commandLink.



h:commandLink Example


<h:commandLink id="next" action="#{courseBean.submit}">
<h:outputText value="Next Page »" />
</h:commandLink>
Next Page »
<h:commandLink id="next" action="#{courseBean.submit}">
<h:graphicImage value="../images/continue_btn.jpg"
alt="Next" title="Next"/>
</h:commandLink>
Next

h:commandLink 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
accesskey
The accesskey attribute is a standard HTML attribute that sets the access key that transfers focus to this element when pressed.
String
charset
The character encoding of the resource linked to by this hyperlink.
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
hreflang
The language of the resource link to by this hyperlink.
String
target
Name of a frame where the resource retrieved via this hyperlink is to be displayed.
String
coords
The coords attribute sets the position and shape of the hotspot on the screen when using this link with a client-side image map.
String
rel
Identifies the relationship from the current document to the anchor specified by this hyperlink.
String
rev
The rev attribute identifies a reverse link from the anchor specified by this hyperlink to the current document. The value of this attribute is a space-separated list of link types.
String
shape
The shape attribute sets the shape of the hotspot on the screen when using this link with a client-side image map.
String
More »» Code Generator
« h:commandButton JSF Tag Home h:dataTable »
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.