Hi folks I am in very strange problem.I have created a client template facelet and template facelet.but when i run my web page it will not insert the defined tag.I mean not working.Here is my code
insert.xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<title>facelet example </title>
</head>
<body>
<ui:insert name="face1"> </ui:insert>
<ui:insert name="face2"> </ui:insert>
<ui:insert name="face3"> </ui:insert>
<ui:insert name="face4"> </ui:insert>
</body>
</html>
compose.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"
xmlns:h="http://java.sun.com/jsf/html">
<body>
<ui:composition template="insert.xhtml">
<ui:define name="face1">
<center><h2>Facelet</h2></center>
<h3>Welcome to the Facelet world..........</h3>
</ui:define>
<ui:define name="face2">Enter UserID :<br/>
<h:inputText id="it" /><br/><br/>
</ui:define>
<ui:define name="face3">Enter Password :<br/>
<h:inputSecret id="is" /><br/><br/>
</ui:define>
<ui:define name="face4">
<h:commandButton id="b" value="Submit" />
</ui:define>
</ui:composition>
</body>
</html>
but when i use <include src="compose.xhtml"> tag in insert.xhtml then it shows the complete facelet.But include tag only works if i write like this
<insert name="face1">
<include src="compose.xhtml"/>
</insert>
if I remove insert tag before include then include also don’t work.I am sick from this strange behaviour of JSF 2.0 facelets.Please help me
Thanks
First of all you need to understand that in tag “template” attribute is optional so it means there is a little mistake in your code.As you know that facelet will include only portion between tag so
this should come with composition not with in html tag.
Your question resembles to this question.I hope this will also help you.
Thanks