I'm trying to implement a custom JS2 command button using UICommand with the latest HTML5 attributes. But, how i can handles the action and actionListener attribues? The UICommand will save thier values, this done by the JSF2 runtime, but how i can know exactly which methode of which bean that i should excute after the button activation by the user in the renderer class at the 'encodeBegin methode'. The source code for the PrimeFaces commandButon renderer class, available here is complicated.
Asked
Active
Viewed 1,340 times
0
-
Thanks BalusC for the help, "how i can hanlde CommandButton actions using Jquery, Ajax and JSF2", this 's really what i'm looking for. – farouk Sep 26 '14 at 12:04
1 Answers
0
In my opinion, you need extend that class (CommandButton or CommandButtonRendered) and override exactly the methods that does not work as you want. Like this for CommandButtonRenderer:
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.primefaces.component.commandbutton.CommandButtonRenderer;
/**
*
* @author nuno_marinho
*/
public class MyCommandButtonRenderer extends CommandButtonRenderer {
@Override
...
}
or like this for CommandButton:
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.primefaces.component.commandbutton.CommandButtonRenderer;
import org.primefaces.component.commandbutton.CommandButton;
/**
*
* @author nuno_marinho
*/
public class MyCommandButton extends CommandButton {
@Override
...
}
And finally you need define the changes for component in faces-config.xml like this:
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.CommandButton</renderer-type>
<renderer-class>com.yourpackage.commandButton.MyCommandButton</renderer-class>
</renderer>
</render-kit>
I hope that explaination can help you!

Marin
- 1,010
- 1
- 10
- 37
-
Thanks Nuno for ur help. I looking for a way to get the value of the action & actionListener attributes from the associated EL specified by the web developers, Does the UICommand JSF2 commponents handle the task? – farouk Sep 24 '14 at 13:01
-
Then, how ican invoke the value in the EL to get the methode invoked during the invoke application phase? Is the JSF runtime responsible for excuting the methods specified in action & actionListener attributes? – farouk Sep 24 '14 at 13:11
-
I can implement a HTML5 button in the JSF specification; using UIcommand, but my problem is, how i can handle the button 's actions during the render phase. For PrimeFaces, it uses 'PF.ab(source,event,update);return false;' how does this solution passe the bean and the methode IDs to the jsf runtime ? – farouk Sep 24 '14 at 13:13