Java Reference
In-Depth Information
JSF handles most of the complexity that you might encounter during development of
a web application. JSF also handles the user clicking a web browser button and send-
ing a request to the server. This request needs to be translated in a way that your appli-
cation can understand. The JSF framework is also responsible for translating and
visualizing responses from the application in a way that the browser can display. The
framework provides a large number of tag libraries that developers can use to visualize
absolutely anything.
Next, we introduce a sample JSF application. In the course of the implementation
we explain the different parts of the application, and further in the chapter we test
our sample application.
15.2
Introducing the sample application
In the previous section we described the parts of a typical JSF application. We now
introduce a real application, the MusicStore application, which we refine and test
throughout this chapter.
The MusicStore is a simple JSF application that presents different kinds of music
albums, which the user can navigate through and purchase. We start the implementa-
tion with a simple POJO (plain old Java object) representing an Album . The implemen-
tation is shown in listing 15.1.
Listing 15.1
Album.java POJO object
[...]
B
public class Album {
private String name = null ;
private String author = null ;
private double price = 0;
private int year = 0;
private String style = null;
private String imageURL = null;
C
public Album(String name,
String author,
double price,
int year,
String style,
String imageURL) {
this .name = name;
this .author = author;
this .price = price;
this .year = year;
this .style = style;
this .imageURL = imageURL;
}
//Getters and setter go here...
}
 
 
 
 
 
Search WWH ::




Custom Search