Building Pages using Apache MyFaces Trinidad 1.2
From ThemesWiki
| Official Page |
| Project Documentation |
| Download |
|
Facelets is a JSF view handler which has, by now, become kind of an official standard for JSF view technology devised for browser clients. As a further refined and extended version, it will become a part of the standard JSF libraries in the oncoming JSF version 2.0, including an option that allows using the current Facelets version. Originally, Facelets have been introduced to cover the main deficiencies of the default combination of JSF with JSP view technology. Therefore, problems regarding incompatibilities between the JSF and JSP life cycle could be fixed by using Facelets as a view handler that is natural to JSF. Moreover, various other enhancements, such as page composition techniques and composition components, have been introduced. Let's have a look at the main benefits of the newly introduced enhancements to Facelets:
- Facelet page composition as a technique to compose one's pages as an assembly of parts
- Facelet composition components allow a simple yet effective encapsulation of reusable parametrized page parts that look and feel like JSF components
- Using JSTL for further refinement of composition components
[edit] Facelet page composition templating with Facelets
Usually, the creation of pages is based on layout templates that make page creation more efficient as the assembly-wise rendering of page parts, that occur in several or all pages, is rendered by a specific engine that is focused towards such a task; in our case, Facelets. What is more, the developer is able to concentrate on the page-specific issues, repeated parts are not re-stated on the page, and the developer does not have to bother with such parts anymore if they are introduced as parts of a layout template.
Therefore, by using a couple of basic Trinidad tags, we go ahead and apply them as part of a general template that defines the layout of all the pages of our sample Trinidad web application:
<trh:html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:tr="http://myfaces.apache.org/trinidad" xmlns:trh="http://myfaces.apache.org/trinidad/html"
These name spaces tell us, and JSF, that we are going to apply the Facelets library ui for the structuring of the template and Trinidad's two JSF libraries tr and trh. It is no surprise that we start off by declaring the XHTML header part:
<trh:head>
<title>
<ui:insert name="title">
Please provide a title!
</ui:insert>
</title>
<meta
http-equiv="Content-Type"
content="text/html; charset=UTF-8"
/>
<script src=
"#{facesContext.externalContext.request.contextPath}/ js/basicScript.js" type="text/javascript"
/>
We define a title area that is inserted by Facelets and contains the actual title; otherwise a warning is displayed with regards to a missing title. Some meta information is declared regarding the content to be XHTML in UTF-8 format. Furthermore, we declare a JavaScript library where application-specific JavaScript functions are kept, mostly only helper functions as we rather stress a rather server-side approach. Next, we define the main body's structure:
<trh:body initialFocusId="#{initialFocusId}">
<div class="body">
<tr:form id="form">
<table
width="990"
border="0"
cellpadding="0"
cellspacing="0">
<tr>
<td
width="990"
valign="top">
<div id="headpart">
<ui:insert name="header">
<ui:include src="header.xhtml" />
</ui:insert>
</div>
</td>
</tr>
</table>
The following screenshot shows the template main body including the header and the navigation part:
The first part of the main body's is, as expected, the header. This is where things like a logo and basic application functionality like login and logout are to be found. Here again we use Facelets which includes header.xhtml; the actual header part if it is not passed otherwise. The next part of the main body comprises of two parts. The first part is on the left hand side and is going to contain the navigation:
<table width="992" border="0" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="200" valign="top"> <div id="left" class="div"> <ui:insert name="navigation"> <ui:include src="navigation.xhtml" /> </ui:insert> </div> </td>
Again, Facelets allows the inclusion of a default navigation.xhtml if not otherwise passed. Finally, we reach the second part that consists of the actual content part:
<td width="792" valign="top"> <div id="center"> <!-- NOTE: allow any kind of additions --> <ui:insert /> </div> </td> </tr> </table> </tr:form> </div> <div class="footer"> Powered by <a href="http://jboss.com/products/seam">Seam</a>. Generated by seam-gen. Adapted for <a href="http://myfaces.apache.org/trinidad">Trinidad</a>, see <a href="http://www.packtpub.com">tutorial</a>. </div> </trh:body> </trh:html>
The following screenshot shows the footer part of the template, including the empty main content:
As expected, this content part is placed next to the navigation on the right-hand side. It is declared in a way that does not restrict the actual content to be inserted.
The following screenshot shows the entire template:
This template defines several areas to be replaced by specific XHTML/JSF page sections. Precisely speaking, in the template these areas are declared by the following ui-prefixed Facelet tags:
-
<ui:insert name="NameOfArea"> DefaultContent </ui:insert>to define a named area to insert XHTML/JSF content starting at the position where<ui:insert name="..>is placed -
<ui:insert />to declare an area that allows inclusion of any kind of XHTML/JSF content starting at the position where<ui:insert />is placed -
<ui:include src="FileToInclude" />to include any kind of XHTML/JSF file (this is practically the same as JSP includes)
The replacements are realized by applying the following elements:
-
<ui:composition template="NameOfTemplate">to indicate which template is to be applied on the respective XHTML page -
<ui:define name="NameOfArea"> RealContent </ui:define>to declare the part of the respective XHTML page content that is going to be inserted into the indicated area (NameOfArea) as defined by its counter pairui:insert - The respective XHTML content part that must be put at the position where
<ui:/insert/>has been placed - The file to be included and storing it in a reachable location; typically, somewhere below the web content directory (
"web_content")
[edit] Using the template
Let us have a look at what the template looks like when applied in a minimal way, that is, we leave out any specific entries and just use it to produce an empty page:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" template="layout/template.xhtml"/>
The following screenshot shows a page that uses the template without passing any contents:
That is it! Of course, for an empty template page we would not even need the taglib declarations. However, we are going to fill the page out with just a bit of content next to see that the replacements work properly:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" template="layout/template.xhtml"> <ui:define name="title"> So I added a title! </ui:define> <ui:define name="header"> And here is a header!! </ui:define> <ui:define name="navigation"> Believe it or not, here is going to be my navigation! </ui:define> <p> And now for something completely different, the content..</p> </ui:composition>
This template client takes advantage of all the areas in the template that were defined as replaceable. We provided a header title, and filled out the header with a bit of other text although we could have filled out a header.xhtml because it is defined in the template if no other input is provided by the template client. We did the same for the navigation area. Finally, we profited from the free, Facelet-untagged area that is passed to the template where anything whatsoever found in the template client is instanced.
The following screenshot shows another template client using the sample template, this time providing concrete, yet simple contents:
[edit] Facelet composition components
Someone has said that Facelet composition components have come to the rescue of JSF. While this might be a bit exaggerated, it can nevertheless count as a remark that hints on the difficulty of writing one's own JSF components. If we compare the steps involved in the process of creating a JSF component with those of Facelet composition components, the latter is clearly much simpler to achieve. Though it is worth mentioning that JSF components also have their own benefits and one cannot solely judge by the amount of effort.
Only the following is required to build a Facelet composition component:
- Create the composition component as an XHTML file using the Facelet composition tag <ui:composition> and the required namespaces for example, Trinidad and JSTL
- Declare the composition component inside of a Facelet tag library XML file that defines its own namespace
- Apply the composition component, then deploy and restart the application (A simple update of above files does not suffice, a full deploy and restart is required)
Let us take a look at an example by creating a select box that includes all the wiring to its domain model and internationalization. Therefore, in the upcoming topic, we will go through above steps by looking at the select box example.
[edit] Creating the composition component
We define a namespace called "face" and a composition component called "fieldSelect".
It comprises of a panelLabelAndMessage component that allows using input components that do not need to be Trinidad components as its children while providing the label and messaging support usual to Trinidad input components. This way, the composition component may remain more flexible for later additions of such components and, moreover, it is even possible to use it in a way that suppresses the standard messaging next to the input component for instance, showing messages in a pop-up message box instead.
The actual composition component 'fieldSelect' applies a selectOneChoice Trinidad component that allows the selection of an item from an item list that is enclosed by the mentioned panelLabelAndMessage component:
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:s="http://jboss.com/products/seam/taglib">
<tr:panelLabelAndMessage
rendered="#{visible}"
label="#{msgLabel}"
for="#{id}"
labelStyle="#{labelStyle}"
inlineStyle="display:none"
showRequired="false">
<tr:selectOneChoice
simple="true"
showRequired="false"
requiredMessageDetail=""
label="#{msgLabel}"
required="#{required}"
disabled="#{readOnly}"
value="#{model}"
id="#{id}"
contentStyle="width: #{width}px;margin-left:#{margin}px">
<ui:insert/>
</tr:selectOneChoice>
</tr:panelLabelAndMessage>
</ui:composition>
Therefore, the following parameters may be passed to this composition component:
-
model: This is the model that keeps the selected item. -
visible: This serves to keep the display state of this component whether or not it is rendered. -
id: This is simply the JSF id; it may also be used to automatically find and use a model of the select items. -
msgLabel: This is the internationalized label of the select box. -
labelStyle: This is style-sheet-related inline definitions for the label. -
required,readOnly: These are used to setup the display. If required is true, Trinidad displays by default an asterisk before the label to denote that this is a required entry whilereadOnly="true"disables the select box. -
widthandmargin: These are used to setup the width and margin of the select box in pixels.
You need to be aware of the fact that the composition component applies <ui:insert/> inside the tr:selectOneChoice container tag, so that the client of this component is able to insert whatever select items are needed, such as the various supported languages.
|
Not all of the declared |
There are a couple of Facelet parameters like msgLabel that do not seem to be passed, but this is something we will catch up with in the next section.
To further illustrate some of the more subtle attributes we will take a look at each of them applied in a simple example.
[edit] The model attribute
As already mentioned, this attribute serves to pass the actual model that is used behind the checkbox. A simple example is:
<face:fieldSelect id="lgSelect" model="#{localeSelector.localeString}"> ...
Thus, the model is behind the getter or setter.
LocaleSelector.instance().getLocaleString()/setLocaleString(String string);
It is simply a String where the actual selection is kept. This is not everything that is behind the model. Of course, the various items from which the actual localeString is selected need to be passed too. This is implemented by taking advantage of the <ui:insert/> definition. Therefore, regarding the model, the complete version of above example would look like this:
<face:fieldSelect id="lgSelect" model="#{localeSelector.localeString}">
<f:selectItems value="#{localeSelector.supportedLocales}" />
</face:fieldSelect>
|
Note that according to the definition of |
[edit] The visible attribute
The visible attribute allows controlling the component's rendered attribute. For instance, we can offer a language or locale selection only if the default locale is different from the browser client's locale, something we will take a closer look at later.
<face:fieldSelect id="lgSelect"
model="#{localeSelector.localeString}"
rendered="#{not facesContext.application.
defaultLocale.displayLanguage.equals
(localeSelector.locale.displayLanguage)}">
[edit] The msgLabel attribute
This attribute allows passing the key to the messages properties. For instance, in our language select box we could use:
<face:fieldSelect id="lgSelect"
model="#{localeSelector.localeString}" label="lang">
in our messages properties if we take a look at the lang key of the German messages we find:
lang.lgSelect=Sprache
Thus, by using the combination of the label prefix and the JSF id we can simply make up a straight-forward convention of key definitions to easily find our internationalized labels.
[edit] The labelStyle attribute
This attribute allows setting up the inline style for our internationalized label, for example, styling it in a font of 14 points would work as follows:
<face:fieldSelect id="lgSelect"
model="#{localeSelector.localeString}"
labelStyle="font-size:14pt">
[edit] The required attribute
To get a visible indication with the default asterisk for inputs that are required in a form and to have the built-in Trinidad-based validation mechanism working, the composition component passes through the Boolean required attribute usual to all JSF input components, for instance:
<face:fieldSelect id="lgSelect"
model="#{localeSelector.localeString}"
required="true">...
Note that to get the visual indication; the composition component needs to apply the standard Trinidad functionality to activate this standard behavior. There are two possibilities to achieve this. One possibility would consist of leaving out the panelLabelAndMessage component and reducing the composition component to the following simpler version:
<tr:selectOneChoice
simple="false"
showRequired="true"
requiredMessageDetail=""
label="#{msgLabel}"
required="#{required}"
disabled="#{readOnly}"
value="#{model}"
id="#{id}"
contentStyle="width: #{width}px;margin-left:#{margin}px">
<ui:insert/>
</tr:selectOneChoice>
However, it would become less flexible for future changes or additions. Alternatively, the second possibility is much more about preserving the composition component's structure and leaves the panelLabelAndMessage component intact:
<tr:panelLabelAndMessage
rendered="#{visible}"
label="#{msgLabel}"
for="#{id}"
labelStyle="#{labelStyle}"
inlineStyle="display:none"
showRequired="true">
<tr:selectOneChoice
simple="true"
showRequired="true"
requiredMessageDetail=""
label="#{msgLabel}"
required="#{required}"
disabled="#{readOnly}"
value="#{model}"
id="#{id}"
contentStyle="width: #{width}px;margin-left:#{margin}px">
<ui:insert/>
</tr:selectOneChoice>
</tr:panelLabelAndMessage>
Therefore, in the second possibility it suffices to switch on the showRequired attribute in both components to get the usual required indication.
[edit] The readOnly attribute
To obtain a disabled checkbox, we turn on this Boolean attribute that passes its value through to Trinidad's disabled attribute, for example:
<face:fieldSelect id="lgSelect"
model="#{localeSelector.localeString}"
readOnly="true" ..> ..
[edit] The width attribute
To override the default width of the select box we can pass its width explicitly as follows:
<face:fieldSelect id="lgSelect"
model="#{localeSelector.localeString}"
width="200" ..> ..
This way we could, for instance, achieve an extra-long width of the select boxes which in some forms would probably look more in harmony with longer fields of the same column.
[edit] The margin attribute
The last attribute that is supported by our composition component allows setting up left margin, for instance:
<face:simpleFieldSelect id="lgSelect" model="#{localeSelector.localeString}" margin="100" ..> ..
The effect is a gap of 100 pixels that is placed between the label and the select box.
[edit] Declaring the composition component
Here, in the second step, we need to create a taglib.xml, which in our web sample application we name seamidad-facelets-taglib.xml. In the fieldSelect composition component must be declared:
<?xml version="1.0"?> <!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd"> <facelet-taglib> <namespace>http://www.packt.com/facelets</namespace> <tag> <tag-name>paramBuilder</tag-name> <source>layout/faceletComponents/paramBuilder.xhtml</source> </tag> <tag> <tag-name>fieldSelect</tag-name> <source>layout/faceletComponents/fieldSelect.xhtml</source> </tag> </facelet-taglib>
Additionally, we indicate another composition component called paramBuilder that which we use to decorate fieldSelect in order to preprocess parameters passed to fieldSelect or other components. We will take a look at that in the following section.
The XML structure is comprised of a container called facelet-taglib with a single namespace child and a series of tag children containers. Each tag's child container is made up of a tag-name child and a source child.
The taglib.xml declarations are rather easy to follow. First, we indicate the namespace that is used from normal taglibs (that is, the ones that are not Facelet taglibs) and followed by the actual series of composition component declarations, each one indicating its name and file path. For instance, the fieldSelect composition component must be declared by its name (tag-name) and its file path (source).
Next the taglib.xml needs to be declared in the web.xml to become known to the application:
<!-- Facelet Tag library --> <context-param> <param-name>facelets.LIBRARIES</param-name> <param-value>/WEB-INF/seamidad-facelets-taglib.xml</param-value> </context-param>
As it can be seen, the declaration consists of a contextual parameter declaration in the web.xml, which is a typical web.xml parameter declaration as we know. For example, from the javax.faces.DEFAULT_SUFFIX declaration where we declare the XHTML suffix to be used as the suffix for our JSF pages.
In this case, we need to simply state the path to our Facelets taglib by setting the facelets.LIBRARIES parameter. This is recognized by Facelets to keep this kind of path, usually located in the WEB-INF folder where also our taglib xml file resides.
[edit] Applying the composition component
Finally, we apply the composition component on a page:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:face="http://www.packt.com/facelets"
template="layout/template.xhtml">
<ui:define name="body">
<tr:form>
<tr:messages styleClass="message"/>
<tr:panelFormLayout>
<face:fieldSelect id="lgSelect" model="#{localeSelector. localeString}" label="lang">
<f:selectItems value="#{localeSelector.supportedLocales}" />
</face:fieldSelect>
</tr:panelFormLayout>
</tr:form>
</ui:define>
</ui:composition>
Our body is conveniently instanced through Facelets page composition as part of the indicated Facelets template. It applies the fieldSelect composition component in a simple way without adding lots of the optionally available attributes, just applying the required attributes id, model, and label as explained earlier.
As we can see, it is located inside a form using a panelFormLayout component for proper form layout. This is discussed later in Tutorial 7, Building a Form. The messages are shown by means of the Trinidad messages component instead of using messages shown next to the input field, which is default functionality of any Trinidad input component.
A simple comparison of the lines we encapsulated as the fieldSelect composition component with the ones we now use to reference it on above page reveals perhaps the most practical advantage of using Facelet composition components. We simply save ourselves a great deal or typing! Of course, on an architectural level the main advantage is that we now have a reusable component that we can specifically adapt and refine to be as powerful as needed.
For instance, we could get rid of the f:selectItems tag and make it part of the composition component itself by using fieldSelect component's id to retrieve the select items on a select items model of the application. Thus, the call of fieldSelect to select the locale language would be simplified to:
<face:fieldSelect id="lgSelect"
model="#{ localeSelector.localeString}" />
This page also takes advantage of a couple of Trinidad tags that we will look at in detail in the upcoming tutorial. Trinidad's form is used to specify a web form including a messages area and an automated layout area (panelFormLayout). In a later version of this template, we will move the form enclosure and messages area to the layout template so the actual syntactic overhead is further reduced for this client's templates. This is usually done in most real-life projects as well.
Finally, the third and last step is needed because the application needs to be redeployed and restarted on the application server since the taglib.xml has been changed. Otherwise, for existing composition components no full redeploy and restart is required. It suffices to date up the composition component's XML file on the application server, and therefore, development is fast and efficient with Facelet component development. With Facelets component, development is fast and efficient.
The following screenshot shows the Facelet fieldSelect composition component for locale choice:
[edit] Using JSTL for further refinement
Originally developed for the now outlived JSP technology to support control structures on JSP pages, JSTL is a tag library that, when used in combination with Facelets, allows for better accessibility of control structures in composition components. Alternatively, one could also apply a combination of Java server-side coding and JSF EL to achieve similar results. However, the advantage here is that JSTL directly allows using control structures on the composition component's page definition. Therefore, control structures related to the composition component are not separated from the definition of the composition component and the developer has all the component-related code bundled together on one or several pages. This is quite easy to manage and maintain because no full redeploys or restarts during development are required. If you need additional information on the topic, watch this video tutorial http://www.videorolls.com/watch/Introduction-to-JSTL-Working-with-JSTL-1-of-2
[edit] Typical JSTL structures
The following JSTL structures are typically used:
-
<c:if test="<EL-condition>"> ... </c:if>: It is used to check if a condition, given as a JSF Expression Logic statement, is fulfilled. For example, if the model has been passed#{empty model}and setup something as a consequence. -
<c:set var="<ParameterName" value="ParameterValue"/>: It is used to setup additional parameters, for example,<c:set var="isLocked" value="false"/>. - With the
choosestructure we are able to formulate if-then-else-conditions:
<c:choose> <c:when test="<EL-condition>"> ... </c:when> <c:otherwise> ... </c:otherwise> </c:choose>
There is still more to JSTL, however, this is basically all we need to create a preprocessor component that is used as decorator of any Facelet composition component we define for a form field:
<c:choose>
<c:when test="#{not empty model}">
<c:set var="value" value="#{model}" />
</c:when>
<c:otherwise>
Error: model must be passed!
</c:otherwise>
</c:choose>
<c:if test="#{empty isLocked}">
<c:set var="isLocked" value="false"/>
</c:if>
<c:set var="msg" value="#{label}.#{id}" />
<c:set var="msgLabel" value="#{messages[msg]}" />
<c:set var="wholeId" value="#{form}:#{id}" />
<c:if test="#{empty required}">
<c:set var="required" value="false" />
</c:if>
<c:if test="#{empty readOnly}">
<c:set var="readOnly" value="#{isLocked}" />
</c:if>
<!-- set the width to a constant value if not passed -->
<c:if test="#{empty width}">
<c:set var="width" value="118" />
</c:if>
Now, regarding the parameters, we can see the missing bits of fieldSelect. The internationalization is done automatically by looking up the respective messages properties file, and label plus id are used as a key for the lookup. The existence of the model is checked; otherwise an error message buy phentermine online is directly displayed on the content page. Some auto insurance quotes parameters are created, derived from others so the user of this component does not need to pass them all. Note that the width is set to a constant value if it is not passed. This is a simple workaround to avoid a layout problem with panelFormLayout and ensures that all the applied select boxes are properly aligned, which is further discussed in Tutorial 3, Most Wanted Tags and Tag Attributes.
In regards to the way to decorate fieldSelect component, this is quite easily accomplished by using the preprocessor as a composition component inside of the definition of fieldSelect:
<paramBuilder> .. </paramBuilder>
We do not even have to restate the passed parameters as they are still available for the preprocessor when fieldSelect is called.
[edit] Things to be aware of when using JSTL and Facelets
For the described simple usage of JSTL, there should not be much to worry about applying composition components that have such a restricted JSTL usage where it is only applied for parameter preprocessing as described.
However, things are not really always this simple. JSTL should always be used with some care in all other cases as intricate situations might arise, particularly when it is used in following constellations:
- Container tags such as
c:ifandc:chooseshould avoid JSF children components unless the developer is fully aware of exactly when, in the JSF life cycle, these tags are executed, and how this impacts the JSF tree.
The same holds for the inverse constellation. JSF container components should avoid JSTL tags as their children. This is potentially critical because it might collide with the life cycle phase order as, always to keep in mind, the JSF tree is built before the components are actually rendered.
In the first constellation, generally, we ought to apply id attributes for the respective JSF components, to make sure that between the JSF life cycle rendering phase, that is, the closing JST tree saving and the initial JSF tree reconstruction phase, no alteration of the JSF tree occurs. This is the way a replacement of components works.
Usually, the first constellation makes sense especially to increase performance, whereas the JSF-pure alternative, which works with essay service the rendered attribute, does not influence the JSF tree creation. Only the state renderedcheapest auto insurance is set, that is, the respective component still lives in the tree. For instance, by using c:if one is able to reduce a tree down its necessary components. A typical example would be authorization-based page construction where only certain components are part of the JSF tree depending on the user's authorization level.
The second constellation is problematic in case where dependencies between the JSF parent component and its children JSTL components exist. As already indicated, the reason is the natural order of the JSF life cycle. At the time when JSTL tags are executed, there is no state available that relates to the closing rendering phase where typically most of the actual component work takes place.
[edit] Other tags to be aware of
You need to be aware that not only JSTL tags require careful handling. The same holds for the application of some of the pure Facelets tags themselves, that is, those prefixed by ui:. Some of them belong to the same category as the JSTL tags, the list is as follows:
c:forEach, c:choose, c:set, c:if</code>, c:otherwise, and so on f:facet, f:actionListener, f:valueChangeListener, and so on ui:include, ui:decorate, ui:composition, and so on and any composition component
According to the Facelets documentation, they are all considered build-time tags. On the other hand, there are component tags such as ui:repeat, ui:fragment, and ui:component.
All in all, the situation has improved since the early days when JSF came out and JSP was used as its view handler. Many deficiencies have been removed by Facelets; a few still remain, as outlined above, but with proper care they can be avoided.
[edit] Source
The source of this content is Chapter 2: Building Pages using Apache MyFaces Trinidad 1.2 of Apache MyFaces Trinidad 1.2: A Practical Guidee by David Thomas (Packt Publishing, 2009).
Logo Designby ThemesWiki.org Kevin Josh 2010
Executive Editor Sean Lopez own : SEO Company and provider of Link Building Services and SEO Services
And Like Costumes and Halloween Costumes and criar sites
And Like The Global Information Network and Global Information Network
