将XML名称空间声明提取到单独的标记文件/标记库中 [英] Extract XML namespace declarations into separate tagfile/taglib

查看:125
本文介绍了将XML名称空间声明提取到单独的标记文件/标记库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

这可能吗?还是我需要复制粘贴每个Facelets文件中的所有XML名称空间?

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

这是一个理论示例,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:

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>

推荐答案

否,不可能.它们必须已经在XML编译期间出现.

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

您最好的选择是在IDE中创建或配置XHTML模板,这样您就可以在 New File 中从中进行选择,而无需复制粘贴/重新输入样板.

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.

以下是 Eclipse + JBoss工具:

这篇关于将XML名称空间声明提取到单独的标记文件/标记库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆