2013-02-09 172 views
0

我在与PrimeFaces 3.4和Facelets 一个问题,我创建了下面的一个Facelets模板:primefaces小面布局显示空白页

<?xml version='1.0' encoding='UTF-8' ?> 

<h:head> 
    <h:outputStylesheet library="css" name="styles.css"></h:outputStylesheet> 
</h:head> 

<h:body> 
    <p:layout fullPage="true"> 
     <p:layoutUnit position="north" size="200px" collapsible="true"> 
      <ui:include src="header.xhtml"></ui:include> 
     </p:layoutUnit> 
     <p:layoutUnit position="south" size="50px" collapsible="true"> 
      Sul 
     </p:layoutUnit> 
     <p:layoutUnit id="contentView" position="center"> 
      <ui:insert name="content"></ui:insert> 
     </p:layoutUnit>   
    </p:layout> 
</h:body> 

我index.xhtml:

<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<ui:composition template="./maintemplate.xhtml" 
       xmlns:h="http://java.sun.com/jsf/html" 
       xmlns:p="http://primefaces.org/ui" 
       xmlns:ui="http://java.sun.com/jsf/facelets"> 
    <ui:define id="contentView" name="content"> 
     <ui:include src="#{userController.currentPage}"></ui:include> 
    </ui:define> 
</ui:composition> 

因此,userController.currentPage在开始处包含一个可用于primeFaces组件的登录页面。 当我点击可用的header.xhtml我有以下里面的菜单:

<p:menuitem value="Tickets" actionListener="#{userController.setCurrentPage('tickets.xhtml')}" update=":contentView" ajax="false"></p:menuitem> 

点击中心布局后得到的空白。我没有看到任何错误或信息,说明有什么问题。 我可以呈现页面tickets.xhtml没有任何问题。

任何帮助最受赞赏。

我使用NetBeans 7.3 RC1 - 的Apache Tomcat 7.0.34.0/PrimaFaces 3.4/JSF 2.1

编辑:把AJAX = “假” 菜单中的作品,但它刷新页面所有。 Anyidea我如何在不刷新整页的情况下完成这项工作,我只想刷新一页。

回答

0

终于设法做到了。 发现在这里如下:

How to ajax-refresh dynamic include content by navigation menu? (JSF SPA)

根据我进行下列操作上面的回答: 1.put阿贾克斯标签和里面的菜单。 2.这也是我的错误,将ajax渲染从<ui:layoutUnit>更改为<h:form> 3.从子xhtml中删除所有h:form标记,因为它现在包含在模板文件中。

之后它没有任何问题。