JSF 2 Composite Component Example

JSF-Thumbnail

Unlike action-based frameworks, such as Struts or Ruby on Rails, jsf is a component-based, which means you can implement components that you or others can reuse. Before JSF 2.0, the using of components was very hard for mainly two reasons: The components were difficult to implement, because of the need to write much more java […]

JSF 2 JavaScript Namespaces Example

JSF-Thumbnail

Already you’ve seen the implementation of monitoring Ajax (request/response) using monitor JavaScript function. That method is fragile, however, because it can be overwritten by another JavaScript method of the same name. To prevent that replacement from happening, you could name your function something more unique, such as net.javabeat.monitor. For protecting our JavaScript from being overwritten, we implement a simple map […]

JSF 2 UI Fragment Example

JSF-Thumbnail

Before JSF 2.0, you’ve used an <f:verbatim/> Tag for rendering a set of JSF components conditionally. The <f:verbatim/> tag creates an output component as a child of the component associated with the enclosing tag. An output component renders the output contained in the body of this tag, such as HTML markup. The <f:verbatim/> is more useful with JavaServer Pages […]

JSF 2 Custom Tags Example

JSF-Thumbnail

You’ve already seen how to lay out user interface elements with templates. In addition, facelets allows you to define a custom tags. A custom tag looks like a regular JSF tag, but it uses the facelets composition mechanism to insert content into your page. Implementing a custom Facelets tags with jsf2.0 is a two step: Implement […]

JSF 2 UI Param Example

JSF-Thumbnail

When you invoke a template, you can supply arguments in two way: with ui:define and with the ui:param tags. As you have already seen; ui:define is used to provide markup that’s inserted into the template. In contrast, ui:param sets an Expression Language (EL) variable for use in a template. In the corresponding template, you can access the parameter with an EL […]

JSF 2 UI Decorate Example

JSF-Thumbnail

Unlike the ui:composition, the ui:decorate is more content-centric approach, in that you write your pages as usual, but you surround the contents with ui:decorate tag that has a template attribute. The decorator in its turn uses the provided template for decorating the contents that written as you’ve determined in the template. Using of ui:decorate is vary differ from the […]

JSF 2 Include Example

JSF-Thumbnail

Facelets was originally developed as an alternative to the JSP-based view handler in JSF1.x. In JSF 2.0 facelets replaces JSP as JSF’s default view technology. In addition to being a better view handler, Facelets supports a number of tags and one of them is a tag for including content from other XHTML pages. Also Read: […]

JSF 2 Template – Composition, Insert and Define Example

JSF-Thumbnail

Most web applications follow a similar pattern, in which all pages have a common layout and styling. It is typical for pages to have the same header, footer and sidebars. Facelets lets you encapsulate that commonality in a template, so that you can update the look of your site by making changes to the template, not […]

JSF 2 Message and Messages Example

JSF-Thumbnail

The <h:message/> and <h:messages/> can be used for displaying the error, fatal error, warning and information messages for single component and for the whole current view respectively. When it comes to develop a JSF page, it happens for a component/view to have a messages that tell the user about some missing or wrong data must be […]

JSF 2 Resource Bundle Example

JSF-Thumbnail

When you implement a web application, it’s good idea to collect message strings in a central location. This process makes it easier to keep messages consistent and, crucially, makes it easier to localize your application for other locales. The messages strings are collected in a file(s) in the properties format, and those files must use […]