|
Facelet |
|
2. 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
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.
In the code below we have taken template
attribute, which indicates the template to which
the content inside this composition tag will be
rendered. Content outside of the composition
tag 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.
composition.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”>
<body>
Content above composition tag will not be
rendered.
<ui:composition template=”/pages/
composition/comptemplate.xhtml”>
<h2>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 composition tag example</
title>
<link href=”../../style/CSS.css”
rel=”stylesheet” type=”text/css”/>
</head>
<body>
<ui:insert />
</body>
</html> |
Rendered Output:
3. Facelet debug tag This tag is useful in displaying the component
tree and scoped variables. This information will
be displayed in a popup window of browser
when we press Ctrl+Shift+(a key). This key
will be specified in hotkey attribute. For example,
in the code below in “debugtemplate.xhtml”,
this has been specified “p”. So when page
comes to the user then if Ctrl+Shift+p is
pressed, debug window is open which displays
the component tree and scoped variables.
debug.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/ |
|
|
Jan 2008 | Java Jazz Up | 78 |
|
|
View All Topics |
All Pages of this Issue |
Pages:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53 ,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63 ,
64,
65 ,
66 ,
67 ,
68 ,
69 ,
70 ,
71 ,
72 ,
73 ,
74 ,
75 ,
76 ,
77 ,
78 ,
79 ,
80 ,
81 ,
82 ,
83,
84 ,
85 ,
86,
87 ,
88,
89 ,
90 ,
91 ,
92 ,
93 ,
94 ,
95 ,
96 ,
97 ,
98 ,
99 ,
100 ,
101 ,
102 ,
103,
104 ,
105 ,
106,
107,
Download PDF |
|
|
|
|
|
|
|
|
|