JSF为组件声明定义自定义名称空间 [英] JSF define custom namespace for component declaration

查看:163
本文介绍了JSF为组件声明定义自定义名称空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在JSF页面中使用外部库中的组件(或自定义组件)时,将添加xmlns声明,例如:

when you use a component from extarnal libraries (or custom component) in JSF page you add the xmlns declaration, for example:

xmlns:util ="http://java.sun.com/jsf/composite/component/util

xmlns:util="http://java.sun.com/jsf/composite/component/util

我想知道如何在Namaspace中使用私有地址,如下所示:

I would like to know what I have to do to use a private address in the Namaspace like this below:

xmlns:p =" http://primefaces.prime.com.tr /ui"

xmlns:p="http://primefaces.prime.com.tr/ui"

这与包裹有关吗?还是取决于包含组件的.JAR的名称?

It is something related to packages? Or it depends from the name of the .JAR that contains the components?

谢谢!

推荐答案

对于Facelets,这是在.taglib.xml文件中定义的.如果是PrimeFaces,则为/META-INF/primefaces-p.taglib.xml:

For Facelets this is definied in .taglib.xml file. In case of PrimeFaces it's /META-INF/primefaces-p.taglib.xml:

<?xml version="1.0" encoding="UTF-8"?>
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
        version="2.0">
    <namespace>http://primefaces.prime.com.tr/ui</namespace>
    ...

请注意<namespace>.对于JSP,这是在.tld文件中定义的,对于PrimeFaces是/META-INF/primefaces-p.tld

Note the <namespace>. For JSP this is definied in the .tld file, for PrimeFaces it's the /META-INF/primefaces-p.tld

<?xml version="1.0" encoding="UTF-8"?>
<taglib xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
    <tlib-version>1.2</tlib-version>
    <short-name>p</short-name>
    <uri>http://primefaces.prime.com.tr/ui</uri>
    ...

注意<uri>.

这篇关于JSF为组件声明定义自定义名称空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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