JSF components and client side interaction

The Oracle JDeveloper 11g – Technology Preview contains several cool JSF components. It’s possible to use them to have some level of client side interaction with those JSF components.

For instance, there is a selectOneChoice component and it’s possible to capture it’s ValueChangeEvent on the client side. Here is the JSPX code:

<af:selectOneChoice value="#{demoInput.choiceValue}">
<af:clientListener type="valueChange" method="doIt" />
<af:selectItem ... />
<f:selectItem ... />
...
</af:selectOneChoice>

Nothing very spectacular, but look again, there is a clientListener tag. The type refers to the type of the client side component event and with method you refer to a custom JavaScript function:


function doIt(event)
{
AdfLogger.LOGGER.severe("old value: " + event.getOldValue());
AdfLogger.LOGGER.severe("new value: " + event.getNewValue());
}

The client side ValueChangeEvent has functions like getOldValue or getNewValue, like you know from the standard JavaServer Faces ValueChangeEvent. The fun here is, that the example uses a client side logger to display both, old and new value. When running on Firefox with Firebug, the Logger prints the result to the Firebug consol:

Oracle JDeveloper 11g - Technology Preview

Enjoy!

Howdy!

Posted in jsf, Oracle ADF Faces, web²

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: