2013-09-03 5 views
0

jsf 1.2에서 특히 템플릿로드에 문제가 있습니다. 내 web.xml은 index.xhtml을 엽니 다.템플릿이 jsf 1.2에서 작동하지 않습니다.

(index.xhtml)

<ui:composition xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:c="http://java.sun.com/jstl/core" 
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich" 
    template="template.xhtml"> 

    <ui:define name="content"> 
     <h1>H1 index</h1> 
    </ui:define> 
</ui:composition> 

(template.xhtml) 내 응용 프로그램을 실행할 때

<?xml version="1.0" encoding="UTF-8" ?> 
<!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:f="http://java.sun.com/jsf/core" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich"> 
<head> 
<title>Titolo</title> 
</head> 
<body> 
    <ui:include src="header.xhtml" /> 

    <ui:insert name="content" /> 

</body> 
</html> 

(header.xhtml)

<ui:composition xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:c="http://java.sun.com/jstl/core" 
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich"> 

<h:outputText value="This is the header 23456"/> 

</ui:composition> 

은 내가 볼 만 "H1 색인". 나는 "This is header 23456"이 보이지 않는다. 나는 제목이 보이지 않는다. 왜?

미리 감사드립니다.

답변

0

<u:define name="content">으로 index.html에서와 마찬가지로 header.html에도 <u:define name="header">을 사용해야합니다. 모든 섹션을 정의하지 않고 템플릿에 "다른 것"을 삽입하려면 템플릿에 <u:insert /> 만 사용하면됩니다. 그러면 정의되지 않은 모든 블록이 템플릿에 삽입됩니다.

+0

답장을 보내 주셔서 감사합니다. 죄송하지만 작동하지 않습니다. template.xhtml이 작동하지 않아 xhtml이 작동하지 않는 것 같습니다. index.xhtml은 web.xml 정의에 있기 때문에 작동합니다. 다른 아이디어있어? – user2741715

관련 문제