将XML名称空间声明提取到单独的标记文件/标记库中

时间:2014-08-27 03:43:16

标签: jsf facelets xml-namespaces taglib

我想将页面顶部的XML命名空间声明分隔成一个单独的(标记)文件,我可以在其中包含我希望的任何Facelets页面。

这可能吗?或者我是否需要在每个Facelets文件中复制所有XML命名空间?

以下是理论示例xmlns.xhtml

<something
    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:c="http://java.sun.com/jsp/jstl/core"
    ...
/>

可以使用它的模板文件:mypage.xhtml

<f:view xmlns="xmlns.xhtml">
    <h:head>
        ...
    </h:head>
    <h:body>
        ...
    </h:body>
</f:view>

1 个答案:

答案 0 :(得分:2)

不,不可能。它们必须在XML编译期间出现。

您最好的选择是在IDE中创建或配置XHTML模板,以便您可以在新文件中进行选择,而无需复制/重新键入样板。

以下是Eclipse + JBoss Tools的一些屏幕:

enter image description here

enter image description here

enter image description here