JSF2.0 passing actions to Composite Components


with JSF 2.0, it is very easy to pass actions to composite components. For example if your composite component is like this:

<composite:attribute name="action" required="true" method-signature="void action(java.lang.String)"/>

<p:commandButton action="#{cc.attrs.action}" value="test me button"/>

then you can use this composite component as :

<custom:testComponent action="#{somePage.testMe('test String')}"/>

as you see, you can pass parameters to the buttons also.

The java side will be as follows btw:

public void testMe(String parameterString){</pre>

easy, huh ?

One thought on “JSF2.0 passing actions to Composite Components

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s