Java Reference
In-Depth Information
Figure 12-22.
AllEmps is now a bad name because users will naturally assume that the page displays all the employees.
We could rename the Facelet but instead we'll remove the filter.
20.
Display the Filters window and click on the condition.
Delete the condition by clicking the X .
21.
22.
Close the window, save the change, refresh the AllEmps page in the browser and confirm
that all the employees are displayed.
Facelets and RAD
Are you amazed at how easy it was to access a data file? The SDO RAD, and the JSF components did quite a bit of
work for you. To explain every object that was created or used is beyond the scope of this text. However, to modify the
application, there are several classes whose function and interactions you need to understand.
First, remember that the Facelets file suffix in the browser address field is faces . When the resource type specified
is faces, the server knows that there is an associated “pagecode” class that needs to be instantiated and defined as a
bean. You may be wondering, “What is a pagecode class?”
Expanding the TutorialsWebJSF/Java Resources/src folder will reveal two folders called pagecode and pagecode.
c12. RAD creates the pagecode folder whenever a Standard Faces Component, Facelet Tag, or Data and Services items
is added to the first Facelet in a project. In addition, a Java class with the same name as the Facelet is created in the
appropriate “pagecode” folder. In the example above, a folder, called c12 was created in WebContent and the Facelet
was created inside of it. Therefore, when the RRL was added to the AllEmps Facelet, RAD created an additional folder
called pagecode.c12. The classes (i.e., the pagecode classes) have the same name as the Facelets and extend the class
PageCodeBase . The PageCodeBase class is one of those classes that “come with” JSF. When the PageCode folder was
created, RAD also imports PageCodeBase.java into the project. (Expand the pagecode folder in JavaResources/src to
see the PageCodeBase.java file.) PageCodeBase contains all the basic functions and variables for a Facelet. Because
our pagecode classes extend PageCodeBase , they inherit these functions and variables.
Get ready. Here comes a really big concept. When a new Facelet function is defined (for instance, adding a RRL
to a Facelet using Page Designer), RAD generates and inserts the methods and variables to perform that function
into the pagecode class. When the Facelet tags try to access the RRL data, the server makes sure that the appropriate
methods are invoked to retrieve the data.
Let's walk through, step-by-step the process that occurred when we created the AllEmps Facelet.
When AllEmps was created in c12, RAD created a new file of type xhtml. The xhtml file (in WebContent/c12)
holds the Facelet (the View portion of our application). See Figure 12-23 .
 
Search WWH ::




Custom Search