3
這是JSF 2.0 Facelets nested templates inheritance的一個擴展轉發,它被鬆散地詢問並正式回答。JSF 2.0 Facelets模板繼承
這裏是我的easy_to_earn問題:
template_base.xhml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head><!-- header stuff --></h:head>
<h:body>
<!-- Lot of html here -->
<div id="main">
<ui:insert name="main_content"/>
</div>
<!-- Lot of html here -->
</h:body>
</html>
接下來,我想另一個模板,form_wrapped.xhtml,這將延長base_template.xhml但用main_content
包裹<h:form>
:
<div id="main">
<h:form>
<!-- "main_content" goes here -->
</h:form>
</div>
和頁:
<ui:composition template="/WEB-INF/templates/form_wrapped.xhtml">
<ui:define name="main_content">
<!-- this html is wrapped by form -->
</ui:define>
</ui:composition>
我該怎麼辦呢?
謝謝,我可以使用相同的「main_content」引用,而不是引入新的「form_content」任何可能性有多大? – Osw 2011-04-13 10:06:56
@Osw是的,我相信你可以通過在form_wrapped.xhtml模板中用「替換 –
2011-04-13 11:18:02