primefaces mobile中的模板

3 mobile-website primefaces jsf-2

如何在primefaces mobile中创建模板,因为根标签是f:view,而不是html.

Bal*_*usC 5

XML根元素无关紧要.它只包含XML名称空间声明.关键是你应该<f:view renderKitId="PRIMEFACES_MOBILE">在主模板中有一个.因此,主模板的以下启动示例应该可以正常工作:

<f:view 
    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:pm="http://primefaces.org/mobile"
    renderKitId="PRIMEFACES_MOBILE"
>
    <ui:insert name="some" />
</f:view>
Run Code Online (Sandbox Code Playgroud)

模板客户端看起来和平常一样:

<ui:composition template="/WEB-INF/template.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:pm="http://primefaces.org/mobile"
>
    <ui:define name="some">
        ...
    </ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)