Nor am I pushing IceFaces as the best component library; I’m using it as an example because I was recently working on a project where it was. How to run AutoComplete Tutorial? I have the Ganymede version of Eclipse installed along with Tomcat I have unzipped the source code. ICEfaces Facelets Tutorial. Facelets is a view technology that focuses on building JSF component trees. Facelets steps outside of the JSP specification and.
|Published (Last):||23 August 2010|
|PDF File Size:||5.43 Mb|
|ePub File Size:||19.24 Mb|
|Price:||Free* [*Free Regsitration Required]|
Facelets is a view technology that focuses on building JSF component trees. Facelets includes many features such as:.
The latest ICEfaces distribution can be found at http: The above code is used to notify JSF to assume a prefix of jspx, which the facelet’s renderer can interpret. This includes the Facelets view handler. Facelets emphasizes its ability to template content in your application. Templating promotes re-use and eases long term maintenance of your application, allowing content to be changed in one spot, but used in multiple pages.
When sjf templating within Facelets, we have iceface roles: Any document can act as a template; but what makes a document a template?
The other half of the equation is the template client. These tags and their uses will be described in greater detail below. For our example, we have developed a site that uses Facelets templating techniques. The site is divided into four parts, header, footer, navigation, and content sections. Each page on the site is run off of the main-template. The header, footer, and navigation is included directly into the template.
The content section is constantly changing therefore it isn’t included directly in the template. The content pages use another template to outline its content.
The content template defines a header and the page content. This will mean that each page that uses the template will have a header and the content sections. This page uses a ui: This will include the header, footer, and navigation pages and allow the content to be defined separetly.
The content pages also use a ui: The page content is defined on another jspx page which is included with an ui: The composition and decorate tags are very similar in the fact that they both wrap content to be included in another Facelet. Any content inside the tag will be included when another Facelets page includes the page containing the composition tag. The following is an example of how the composition tag works:.
ICEfaces Facelets Tutorial
The decorate tag is handled a little differently. Any content outside of the UI Decorate tag will be displayed by the Facelets view handler. Any content within the decorate tag will be passed to the associated template as parameters or simply ignored. The following is an example of how the decorate tag works:.
The insert tag is a templating tag that declares a named content element to be defined by another Facelet. It can be used effectively with the ui: The define tag is a templating tag that defines named content to be inserted into a template.
The name attribute value must match that of a ui: The following is an example on how the two tags work in conjunction with each other:. The include tag is a server-side include tag for Facelets.
It simply includes the document pointed to by the? The included document should use a component or composition tag to trim unnecessary markup, or it may simply contain a fragment of XHTML or XML to be included. For dynamic includes the? When the navigation is changed user clicks a new linkthe backing bean value us also changed thus changing the include value. This enables the use of a single include tag to be used in the template.
The following is an snd of how it can be basically used:. The following code shows how the include ahd can be used for dynamically including content:. For more information on dynamic includes using Facelets see the Tutoriao Tutorial located here. Facelets is not only just used for templates.
JSF Components – A Quick Example Using ICEFaces | Keyhole Software
You can create your own custom tags to be used in your application. Creating your own custom tags can be beneficial due to it will promote code re-use and portability. For our example we have a register form, it consists of a few labels and a few input text boxes. Normally this would take quite a few lines of code to create:.
The following code renders a similar output using the custom component we have created:. Notice the big difference in the amount of code?
The second example is getting icefacds information from the backing bean. The nice thing about doing it this was is say if there was a search or edit page, the form used would probably be similar. Instead of re writing the same code all over again we can use our custom component.
The following is an example of the tag library:. The faceletsTutorial Tag library only defines one tag but all of the tags tutkrial used in the application should be defined in the same tag library file. Note the namespace element that is declared before the tag element, it will be used in the facelets page. This will tell Facelets the that tag library exists so it can use it. The icefacez is how it should be declared:. Note you can also define multiple tag libraries to be used by passing facelets.
Once the tagfile has been created and defined in the tag library its ready to be used. To use the tagfile, declare it as an XML namespace, shown below:. Download the source code here. The example shows a general overview of how Facelets templating works. Basic site example on how to use Facelets. Includes samples on templating and custom components.