JavaScript inside the page. Here is a JSF
page source code snippet (index.xhtml):
<demo:chart data="#{ iceCreamSurvey.result}"
response="#{ iceCreamSurvey.reply( param.input)}" />
<h:outputScript
library="javax.faces"
name="jsf.js" target="head"/>
We need to further map the request
parameter input as well as the response
attribute exposed by our custom chart
tag. There are several options to do this.
One way is to utilize a JSF 2.0 enhance-
ment that allows EL action binding to
take variables (see Listing 12).
JAVA IN ACTION
ABOUT US
Integrating with JavaFX
We can similarly implement the chart
application in JavaFX (see Figure 2).
Listing 14 shows the JavaFX source
code (
demo.piechart.Main.FX). The
pie chart data is provided by function
getChartData(), as seen in Listing 15.
See all listings as text
or JavaFX is used to provide the chart is
an implementation detail and is totally
transparent to the consuming page.
on encoding, decoding, and view state
tracking. In particular, we created a
custom component to encapsulate the
embedding of Flex and JavaFX. ●
chocolate
30%
vanilla
60%
chart.refresh?
chart.refresh(response) :
chart.script.refresh(response)
Conclusion
In this article, we took advantage of new
features in JSF 2.0 to integrate Adobe
Flex and JavaFX into our JSF applications. These new capabilities free us
from the need to take care of plumbing
LEARN MORE
•;JavaFX
•;Adobe Flex
•;JavaServer Faces 2.0 download
blog
Figure 2
That’s it. There is no need to change
the consuming JSF page. Whether JSF