2

eclipse (juno 以前) にカスタム 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 の家庭料理バージョンです。

ただし、omnifaces (単なる例) とは対照的に、この 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+space を押すと、タグ、属性の提案が表示されました。

入力すると

<sc:

次に CTRL+space を押しても、何も得られませんでした。

私のライブラリは、オムニフェイスと同じように私のプロジェクトの依存関係として定義されています...

omn​​ifaces pom.xmlには特別なものは何もありませんでした。私は何をすべきか?

4

1 に答える 1

2

以下は少なくとも Eclipse 2.7.2/Indigo で動作します。

トリニダードの実装を確認すると、同じフォルダーに.tld同じ内容のファイル (1:1 の同じ内容ではなく、以下の.tld形式を参照)も必要であることが明らかになりました。WEB-INF.taglib.xml

.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>
于 2012-11-14T10:19:13.343 に答える