在JSF中,页面标题不会在页面之间更改
我在应用程序中使用页面模板,因此我使用在JSF中,页面标题不会在页面之间更改,jsf,primefaces,facelets,Jsf,Primefaces,Facelets,我在应用程序中使用页面模板,因此我使用、和。对于页面的标题,我遵循BalusC提到的相同内容;但每页的标题都是一样的。当我看到页面源代码时,实际的标题就在那里。标题栏在每个页面上显示相同的标题,但页面源具有正确的页面标题,这怎么可能呢 模板页面MainTemplate.xhtml: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.c
、
和
。对于页面的标题,我遵循BalusC提到的相同内容;但每页的标题都是一样的。当我看到页面源代码时,实际的标题就在那里。标题栏在每个页面上显示相同的标题,但页面源具有正确的页面标题,这怎么可能呢
模板页面MainTemplate.xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:pe="http://primefaces.org/ui/extensions"
xmlns:f="http://java.sun.com/jsf/core" xml:lang="en" lang="en">
<h:head>
<title><ui:insert name="title">Place holder for title</ui:insert>
</title>
</h:head>
<h:body>
</h:body>
</html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" template="MainTemplate.xhtml">
<ui:define name="body">
<h:outputScript library="script" name="processcript.js" target="head" />
<h:form id="baseForm">
</h:form>
*some layout is defined here*
</ui:define>
</ui:composition>
职位持有人
使用MainTemplate.xhtml的第二个模板-
模板1.xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:pe="http://primefaces.org/ui/extensions"
xmlns:f="http://java.sun.com/jsf/core" xml:lang="en" lang="en">
<h:head>
<title><ui:insert name="title">Place holder for title</ui:insert>
</title>
</h:head>
<h:body>
</h:body>
</html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" template="MainTemplate.xhtml">
<ui:define name="body">
<h:outputScript library="script" name="processcript.js" target="head" />
<h:form id="baseForm">
</h:form>
*some layout is defined here*
</ui:define>
</ui:composition>
*这里定义了一些布局*
使用上述模板的页面:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
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:pe="http://primefaces.org/ui/extensions"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<head></head>
<h:body>
<ui:composition template="/WEB-INF/templates/Template1.xhtml">
<ui:define name="title">
<h:outputText value="#{myBean.title}"></h:outputText>
</ui:define>
</ui:composition>
</h:body>
</html>
您的
HTML标记是否位于文档的标题部分?还有,它只提供一次吗?如果您能提供一些代码示例,将更容易帮助您发送代码以获取更多信息