Wednesday, August 27, 2014

How to define Default Action in PrimeFaces

This is to define what action to be executed when the "Enter" is press.

There is easy-to-use component in PrimeFaces to get this done.


<p:defaultCommand target="btn2" />

<p:commandButton id="btn1" action="#{myBean.action1}" />
<p:commandButton id="btn2" action="#{myBean.action2}" />
<p:commandButton id="btn3" action="#{myBean.action3}" />

with the above code, when user press on "Enter", action to be executed is #{myBean.action2} that bind to <p:commandButton id="btn2" />


Done!!

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...