【发布时间】:2014-11-19 07:42:44
【问题描述】:
我对这个简单的代码有问题,我无法正确查看“footer.xhtml”内容(单词“Wooorks”)
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>piloto_18</display-name>
<welcome-file-list>
<welcome-file>layout.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
layout.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">
<h:head>
<title>Facelets Template</title>
</h:head>
<h:body>
<ui:insert name="footer">Not working</ui:insert>
</h:body>
</html>
footer.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
template="layout.xhtml">
<ui:define name="footer"> working!!! </ui:define>
</ui:composition>
任何帮助将不胜感激:)
【问题讨论】:
-
您是否要在 layout.xhtml 中包含 footer.xhtml?
-
没有@SalihErikci。我试图在 layout.xhtml 中嵌入 footer.xhtml 以显示“工作”。