简体   繁体   中英

primefaces component (P:layout) not working at all

I'm trying to use the example of PrimeFaces showcase ElementLayout but the layout is not diplayed at all !

I already saw a kind of problem related with my issue like (right namespaces, doctype...) but nothing works for me.

In my pom file, i declared jsf-api:2.0(provided) and primefaces:3.5

my layout.xhtml looks like this :

  <!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>        

and the page.xhtml that i display looks like this :

  <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>

I have tried all kind of layout in primefaces showcase no one works for me

enter link description here

thanks for your help

This is a styling issue. Download this jar from Primefaces Aristo

and make sure that this is available in applications classpath and do the changes to web.xml file don't specify any context-param for "primefaces.THEME".

Hope this helps

Had similar issue where layouts are rendering in JSF. The solution is in web.xml.

<welcome-file-list> in web.xml should be as follows

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

if you just have index.xhtml, layouts will not be rendered

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM