What is the difference between H commandButton and H commandLink?

1 Answers
Answered by suresh

Difference between h:commandButton and h:commandLink

Difference between h:commandButton and h:commandLink in JSF

h:commandButton and h:commandLink are both components in JavaServer Faces (JSF) that are used to trigger actions when clicked. However, there are some key differences between the two:

  • h:commandButton: This component is typically used to submit a form and trigger a server-side action. It is rendered as a button element in HTML and is commonly used for submitting forms or invoking actions that update server-side data.
  • h:commandLink: On the other hand, h:commandLink is used to navigate to a different page or URL when clicked. It is rendered as an anchor element in HTML and is commonly used for navigation purposes within a JSF application.

In summary, h:commandButton is more suited for submitting forms and triggering server-side actions, while h:commandLink is used for navigation purposes within a JSF application.

Answer for Question: What is the difference between H commandButton and H commandLink?