Sunday, January 06, 2013

JSF 2.1 Tip of the Day: Programmatically Creating a <h:commandButton/>

I have been doing a lot of work on JSF lately including making custom components. It seems like the whole process of creating custom components looks like some arcane arts. It almost seems like black magic in some cases.

I thought I would share some of the things I have discovered over time in an attempt to help others avoid some of the pitfalls I have come across.
This JSF Tip of the Day is an amalgamation of a couple of tips: JSF 2.x Tip of the Day: Programmatically Creating EL ValueExpression and JSF 2.x Tip of the Day: Programmatically Creating EL MethodExpression which are combined with this tip.

In this tip we will create a <h:commandButton/> programmatically. The code from the previous tips noted, are used to create the component.

The component is bound using the following:

0 comments :

Popular Posts