|Home > Documentation > Reference > Samples > Java EE sample applications > converter-javaee6 - A simple JSF+Ajax aplication|
This sample is a simple currency exchange converter. For a given amount of money in RMB,the converter will calculate the amount in other kind of currency according to current exchange rate.
This Sample mainly features JSF 2.0 enhancement: AJAX support in JSF 2.0.
Converter-javaee6 application consists of following list of packages and classes.
The list of web application files in the application is depicted in the following.
The deployment descriptor file web.xml defines the welcome-file of the web application,parameter for the web context and a "Faces Servlet".
The deployment plan file geronimo-web.xml describes information about the project such as module's unique identification and dependencies inside the <sys:environment/> tags. It is one of the best practices to give your module an unique identification, so that it can later be referenced by some other deployable applications. The path specified in the <context-root> tag will be the entry point of this web application. Therefore the sample application can be accessed at http://<hostname>:<port>/ converter-javaee6.
index.xhtml is a page which displays current exchange rate between RMB and other currencies such as USD, HKD, JPY, EUR and GBP. Input the amount of RMB, you will get the converted amount in other kind of currencies within no minutes through AJAX techniques. When you input a letter in the currency amount box, action goes to server, server computes the converted amount of currency and update the values in managed bean, then send the value back to client, replace the element in the DOM tree with new value.
<h:dataTable> is a component that builds a table from a collection. The collection can be accessed via getter method in managed bean.
<f:ajax event="keyup" execute="@this" render="out1" />
ConverterBean.java annotated with @ManagedBean and @RequestScoped is used as a managed bean for index.xhtml page above. The bean defines the properties and methods associated with the UI components used on the page.
Please reference Samples General Information for information on obtaining and building the source for this and other samples.
Once all the sources get checked out the next step is to build converter-javaee6 sample. It requires Maven 2 for building the binaries.
From the < converter-javaee6_home> directory run the following command.
This process will take a couple of minutes. The binaries will be generated in the corresponding target directory .
Deploying sample application is pretty straight forward as we are going to use the Geronimo Console.
The app is visible at http://localhost:8080/converter-javaee6 .