嗨夥計們我在非常奇怪的問題。我已經創建了一個客戶端模板facelet和模板facelet.but當我運行我的網頁時,它不會插入定義的標記。我的意思是不working.Here是我的代碼
insert.xhtml: <ui:insert>標籤不工作在facelets
<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>
但是當我使用insert.xhtml <include src="compose.xhtml">
標籤則顯示了完整的facelet.But包括標籤只有工作,如果我這樣寫
<insert name="face1">
<include src="compose.xhtml"/>
</insert>
如果我刪除insert
標記之前包括然後也包括不幹活就討厭從JSF 2.0這種奇怪的行爲facelets.Please幫我
感謝
你能解釋一點點嗎?在哪個文件和哪裏?由於我是JSF的新手,所以無法理解您的答案...... – khan 2012-07-12 18:31:19