1

I have search and fetch the following information .
Please add your Information

h:commandbutton is same as a4j:commandButton the only difference is a4j:commandButton have extra ajax request.

a4j:commmandButton is not used for page navigation.
h:commandLink is same as a4j:commandLink the only difference is a4j:commandLink have extra ajax request.

I want to know when we have to use h:commandButton ,a4j:commandButton ,h:commmandLink and a4j:commandLink.

What is the difference in h:commandLink and h:outputlink ? h:commandLink have submit action whereas h:outputlink not.

h:outputLink is used when we want to navigate from one page to another.
but for navigation we can use h:commandlink also then what are the use of h:outputLink?

Vasil Lukach
  • 3,658
  • 3
  • 31
  • 40
vijayk
  • 2,633
  • 14
  • 38
  • 59

1 Answers1

1

h: tags and the a4j: tags are largely similar except the documentation for a4j: states: (paraphrased slightly)

a4j: is similar to the standard h:, but produces an Ajax request with a further partial page update. 'reRender' attribute points to the component(s) that should be re-rendered in the component tree and updated in the browser DOM after an Ajax Response is completed.


Difference between h: link tags:

The renders a fullworthy HTML element with the proper URL in the href attribute which fires a bookmarkable GET request. It cannot directly invoke a managed bean action method.

<h:outputLink value="destination.xhtml">link text</h:outputLink>

The renders a HTML element with an onclick script which submits a (hidden) POST form and can invoke a managed bean action method. It's also required to be placed inside a .

<h:form>
    <h:commandLink value="link text" action="destination" />
</h:form>

For more about different links: check this out!

Community
  • 1
  • 1
Josef E.
  • 2,179
  • 4
  • 15
  • 30