Jsf primefaces组件(P:布局)完全不工作

Jsf primefaces组件(P:布局)完全不工作,jsf,layout,jsf-2,primefaces,Jsf,Layout,Jsf 2,Primefaces,我尝试使用PrimeFaces showcase的示例 但是布局根本没有显示出来 我已经看到了一种与我的问题相关的问题,比如(正确的名称空间,doctype…),但是没有任何东西适合我 在我的pom文件中,我声明了JSFAPI:2.0(已提供)和primefaces:3.5 my layout.xhtml如下所示: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/

我尝试使用PrimeFaces showcase的示例 但是布局根本没有显示出来

我已经看到了一种与我的问题相关的问题,比如(正确的名称空间,doctype…),但是没有任何东西适合我

在我的pom文件中,我声明了JSFAPI:2.0(已提供)和primefaces:3.5

my 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:f="http://java.sun.com/jsf/core"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:p="http://primefaces.org/ui">

 <h:head>
    <title>Title</title>
  </h:head>
  <h:body>
          <p:layout fullPage="true">
        <p:layoutUnit position="north" size="100" header="Top" resizable="true" closable="true" collapsible="true">
            <h:outputText value="Top unit content." />
          </p:layoutUnit>

          <p:layoutUnit position="south" size="100" header="Bottom" resizable="true" closable="true" collapsible="true">
              <h:outputText value="South unit content." />
          </p:layoutUnit>

         <p:layoutUnit position="west" size="200" header="Left" resizable="true" closable="true" collapsible="true">
            <h:form>
                <!-- ..... -->
            </h:form>
         </p:layoutUnit>

        <p:layoutUnit position="east" size="200" header="Right" resizable="true"    closable="true" collapsible="true" effect="drop">
            <h:outputText value="Right unit content." />
        </p:layoutUnit>

        <p:layoutUnit position="center">
            <ui:insert name="content">Put default content here, if any.</ui:insert>
        </p:layoutUnit>
    </p:layout>
</h:body>        
  <ui:composition template="/templates/layout.xhtml"
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:p="http://primefaces.org/ui">      
   <ui:define name="content">
     <h:form>
        <p:commandButton value="View" icon="ui-icon-extlink"
            actionListener="#{dialogBean.viewCars()}" />

        <p:commandButton value="Options" icon="ui-icon-extlink"
            actionListener="#{dialogBean.viewCarsCustomized()}" />
    </h:form>
  </ui:define>
    </ui:composition>

标题
将默认内容放在此处(如果有)。

我显示的page.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:f="http://java.sun.com/jsf/core"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:p="http://primefaces.org/ui">

 <h:head>
    <title>Title</title>
  </h:head>
  <h:body>
          <p:layout fullPage="true">
        <p:layoutUnit position="north" size="100" header="Top" resizable="true" closable="true" collapsible="true">
            <h:outputText value="Top unit content." />
          </p:layoutUnit>

          <p:layoutUnit position="south" size="100" header="Bottom" resizable="true" closable="true" collapsible="true">
              <h:outputText value="South unit content." />
          </p:layoutUnit>

         <p:layoutUnit position="west" size="200" header="Left" resizable="true" closable="true" collapsible="true">
            <h:form>
                <!-- ..... -->
            </h:form>
         </p:layoutUnit>

        <p:layoutUnit position="east" size="200" header="Right" resizable="true"    closable="true" collapsible="true" effect="drop">
            <h:outputText value="Right unit content." />
        </p:layoutUnit>

        <p:layoutUnit position="center">
            <ui:insert name="content">Put default content here, if any.</ui:insert>
        </p:layoutUnit>
    </p:layout>
</h:body>        
  <ui:composition template="/templates/layout.xhtml"
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:p="http://primefaces.org/ui">      
   <ui:define name="content">
     <h:form>
        <p:commandButton value="View" icon="ui-icon-extlink"
            actionListener="#{dialogBean.viewCars()}" />

        <p:commandButton value="Options" icon="ui-icon-extlink"
            actionListener="#{dialogBean.viewCarsCustomized()}" />
    </h:form>
  </ui:define>
    </ui:composition>

我在primefaces showcase中尝试了各种布局,没有人适合我

感谢您的帮助

这是一个造型问题。 从下载此jar

并确保这在应用程序类路径中可用 对web.xml文件所做的更改不要为“primefaces.THEME”指定任何上下文参数


希望这有助于

在JSF中呈现布局时遇到类似的问题。解决方案是web.xml

web.xml中的
应如下所示

<welcome-file-list>
    <welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>

faces/index.xhtml

如果您只有index.xhtml,布局将不会被呈现

您想做什么?在第一页中显示第二页?这不是真的。这取决于如何将facelet页面映射到url。。。您的答案仅在web.xml的上下文中有效。不是通用答案此配置与URL映射无关。我仍然使用访问我的应用程序。我的index.xhtml直接放在WEB-INF中,这取决于Facesservlet的url映射是如何完成的……相信我