0

I have identical actions for commandLink and commandButton. However, commandLink works as expected. But with commandButton no action occurs. Am I missing syntax?

<p:commandLink value="Submit"  action="#{beanController.getStr(strSearch)}" ajax="false"/>
         <p:commandButton value="Submit"  actionListener="#{beanController.getStr(strSearch)}" ajax="false"/>     
Moe
  • 1,427
  • 4
  • 34
  • 54
  • 2
    Do you mean no navigation occurs? If so did you intend on using `action` instead of `actionListener` in your `commandButton`? – PDStat Apr 18 '16 at 13:42
  • Thank you, that's what it was. It works now. – Moe Apr 18 '16 at 14:09

2 Answers2

2

If you intend for navigation to occur you should use action not actionListener in your commandButton, so:

<p:commandButton value="Submit"  action="#{beanController.getStr(strSearch)}" ajax="false"/>
PDStat
  • 5,513
  • 10
  • 51
  • 86
  • Thanks, I was about to lookup the difference between them. and I saw your answer. – Moe Apr 18 '16 at 14:16
0

commandButton button generates a HTML <input type="submit"> element and the commandLink generates a HTML <a> and comandButton is using to submit the form whereas commandlink is used to submit a link,so your form is not submitting i'll suggest you to check if there is any nested form is present or not or if there is multiple forms in your code or any other issue which is causing in form submit, if you can then post your code.

techipank
  • 432
  • 4
  • 17