Extract XML namespace declarations into separate tagfile/taglib

余生长醉 提交于 2019-12-02 06:31:03

问题


I would like to seperate my XML namespace declarations at the top of the page into a seperate (tag)file in which I can include in any Facelets page I wish.

Is this possible? Or do I need to copypaste all XML namespaces in each Facelets file?

Here's a theoretical example, 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"
    ...
/>

And the template file which could use it: mypage.xhtml:

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

回答1:


Nope, not possible. They must be present during XML compile time already.

Your best bet is creating or configuring XHTML template(s) in your IDE so that you can choose from them in New File without the need to copypaste/retype the boilerplate.

Here are some screens from Eclipse + JBoss Tools:



来源:https://stackoverflow.com/questions/25518600/extract-xml-namespace-declarations-into-separate-tagfile-taglib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!