Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Facelet composition Tag 
 

This is a templating tag and is used for the wrapping the content that can be included in any other facelet. This tag provides some useful features.

 

Facelet composition Tag

                          

This is a templating tag and is used for the wrapping the content that can be included in any other facelet. This tag provides some useful features. Any content outside of this tag is left to be rendered. You can  include normal html content  in your page but Facelet will render only content that is within this tag i.e. composition tag. This tag takes one attribute named "template". This attribute is set to the path of the template where the content of this tag will be included. 

Code Description : 

composition.xhtml :
In the code below we have taken template attribute which indicates the template to which the content inside this composition tag will be rendered. Here we have written some content outside of the composition tag, that content will not be rendered. In the comptemplate.xhtml we have used insert tag to include the content inside the composition tag to the comptemplate.xhtml page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:ui="http://java.sun.com/jsf/facelets">
   <body>
        Content above composition tag will not be rendered.
        <ui:composition template="/pages/composition/comptemplate.xhtml">
             <h2>This is the content to be included in the comptemplate.xhtml page.</h2>
        </ui:composition>
        Content below composition tag will not be rendered.
   </body>
</html>

 comptemplate.xhtml :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:ui="http://java.sun.com/jsf/facelets">
    <head>
        <title>facelet example </title>
            <link href="../../style/CSS.css" rel="stylesheet" type="text/css"/>
    </head>
    <body> 
        <ui:insert />
    </body>
</html>

 Rendered Output :

Html Source Code :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
       <title>facelet example </title>
            <link href="../../style/CSS.css" rel="stylesheet" type="text/css" />
      </head>
      <body>
           <h2>This is the content to be included in the comptemplate.xhtml page.</h2>
      </body>
</html>

 This tag contains only one attribute :

template : This attribute is set to the template where the content inside this tag will be included.

                          

» View all related tutorials
Related Tags: c com memory server dynamic tree components core component tag name this node oo ibm create root like for example

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.