By using our site, you acknowledge that you have read and understand our Cookie Policy , Privacy Policy , and our Terms of Service. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I'm new in developing web applications and I installed the ICEfaces plugin. I found this tutorial to learn how to work with it and the first given example dont work in my IDE.

Author:Mazujin Brall
Language:English (Spanish)
Published (Last):23 October 2011
PDF File Size:19.59 Mb
ePub File Size:3.1 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 above code is used to notify JSF to assume a prefix of jspx, which the facelet's renderer can interpret.

Note that the. 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 describing templating within Facelets, we have two roles: the template and the template client. 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. 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:composition tag which is linked to the main-template tenplate. This will include the header, footer, and navigation pages and allow the content to be defined separetly. The content pages also use a ui:decorate tag to link the content template to the page. The page content is defined on another jspx page which is included with an ui:include tag. 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:.

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. Also nested ui:define tags can be used to pass names content to the associated template. 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:define tag to pass values between facelets. 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:insert tag in the target template for the named content to be included. 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 link , the 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 example of how it can be basically used:. The following code shows how the include tag can be used for dynamically including content:. For more information on dynamic includes using Facelets see the Dynamic-Includes Tutorial located here.

Facelets is not only just used for templates. 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 the 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 being 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 following 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 demo: 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.


Subscribe to RSS

Facelets is a view technology that focuses on building JSF component trees. Facelets includes many features such as:. The above code is used to notify JSF to assume a prefix of jspx, which the facelet's renderer can interpret. Note that the. This includes the Facelets view handler.


tutorial « IceFaces « JSF Q&A

Do you know any good tutorial, for making a really simple journal blog like web app with ICEFaces, using Netbeans 6. I have the Ganymede version of Eclipse installed along with Tomcat 6. I have unzipped the source code folders from one of the tutorials on this site and placed it inside a Dynamic Web Project that I have created. I think the way I I'm getting troubles trying the tutorial examples the timezone thingy. Ok, well the first one was no problem since I have advanced programming skills in JSF.


Tutorials & Samples

This is a continuation of my previous entry on component based java frameworks. In this post, I would like to give a couple of examples of the kinds of components that can be used to quickly bring up a user interface. I would like to first reiterate that what you choose is going to depend on your needs for a particular project. JSF and component libraries are perfect for certain situations, but may not be a good choice at all for others. If you want to have a lot of control over the JavaScript, then this is not the solution. However, in some cases, component libraries can help you get your user interface up and running both quickly and effectively. I am in no way encouraging anyone to stay away go play with the new frameworks for JavaScript and you will be saying how much fun it can be too.


JSF Components – A Quick Example Using ICEFaces


Related Articles