我希望Eclipse(Juno或Elder)为我的自定义Taglib提议完成。
所以,我写了一个.taglib.xml文件,其代码为:
<?xml version="1.0" encoding="UTF-8"?>
<facelet-taglib id="sc"
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://www.senat.fr/taglib/sencommons</namespace>
<tag>
<description>
<![CDATA[
blah blah blah
]]>
</description>
<tag-name>senDateYearBegEnd</tag-name>
<component>
<component-type>fr.senat.faces.validators.SenDateYearBegEnd</component-type>
</component>
<attribute>
<description>
<![CDATA[
Identifiant unique.
]]>
</description>
<name>id</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
[...]
</tag>
</facelet-taglib>
这个.taglib.xml文件在Meta-Inf目录中
示例标签是全家烹饪版的Omnifaces validatemultiple。
但是,与一个imnifaces相反(只是一个示例),当我使用包含此taglib定义的依赖项在xhtml文件中使用此lib时,我在eclipse中没有完成。
示例:
<html lang="fr"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui"
xmlns:sen="http://java.sun.com/jsf/composite/sen"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:sf="http://www.senat.fr/taglib/senfunctions"
xmlns:sc="http://www.senat.fr/taglib/sencommons"
xmlns:o="http://omnifaces.org/ui"
xmlns:of="http://omnifaces.org/functions">
如果我键入
<o:
然后按Ctrl 空间,我得到了标签的建议,然后属于属性。
如果我键入
<sc:
然后按Ctrl 空间,我什么都没有。
我的lib定义为我项目的依赖性,就像imnifaces相同的方式...
我在omlnifaces pom.xml中没有看到任何speecial。我该怎么办?
至少在Eclipse 2.7.2/indigo工作。
检查Trinidad实施情况表明,它还需要一个具有相等内容的.tld
文件(不是1:1相同的内容,请参见下面的.tld
格式)与WEB-INF
文件夹中的CC_3文件夹。
.tld
-> mytaglib.taglib.xml
-> mytaglib.tld
tld内容应该看起来像这样 - 仅供参考 - 您必须填写所有内容:
<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-jsptaglibrary_2_1.xsd" version="2.1">
<display-name>'free text'</display-name>
<tlib-version>1.0.0</tlib-version>
<short-name>'match with name preceding .taglib.xml'</short-name>
<uri>'your url'</uri>
<tag>
<description>
</description>
<name>'tag name'</name>
<body-content></body-content>
<attribute>
<description></description>
<name></name>
<required></required>
<deferred-value/>
</attribute>
</tag>
</taglib>