简体   繁体   English

Eclipse找不到JSF 2.2标签库

[英]Eclipse can't find JSF 2.2 taglibs

I am using JSF 2.2 taglibs but Eclipse is displaying the following warning message: 我正在使用JSF 2.2 taglibs,但是Eclipse显示以下警告消息:

Can't find facelet tag library for uri http://xmlns.jcp.org/jsf 找不到uri的Facelet标签库http://xmlns.jcp.org/jsf

What bugs me is that I've faced this issue before and it was related to classpath JARs, but now it is only affecting JSF 2.2 tag libs. 让我感到烦恼的是,我之前曾遇到过此问题,它与类路径JAR有关,但现在它仅影响JSF 2.2标记库。

Taglib xmlns:h="http://xmlns.jcp.org/jsf/html" is working fine, the warning is shown to JSF 2.2 specifics like "/jsf" and "/jsf/passthrough" . Taglib xmlns:h="http://xmlns.jcp.org/jsf/html"正常工作,警告显示给JSF 2.2细节,例如"/jsf""/jsf/passthrough" Here is an image showing warnings for JSF 2.2. 这是显示JSF 2.2警告的图像。 tag libs, but prior namespaces are loaded correctly. 标签库,但先前的名称空间已正确加载。

JSF 2.2标记库的警告

I have tried to solve the issue with help of posts like this but none of the procedures (clean, restart, close/open, validate, etc) have worked for me. 我曾尝试通过类似此类的帖子来解决此问题,但是没有一个程序(清理,重启,关闭/打开,验证等)对我有用。

Dependencies for JSF (derived from WildFly 10.1 pom.xml): JSF的依赖关系(源自WildFly 10.1 pom.xml):

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.13</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.13.SP1</version>
        <scope>provided</scope>
    </dependency>

Eclipse info: Eclipse信息:

Version: Neon.1a Release (4.6.1)
Build id: 20161007-1200

Update 更新

After looking into the taglib files I found no "passthrough" or "friendly markup" reference. 在查看了标签库文件后,我没有找到“传递”或“友好标记”参考。 So there is no surprise Eclipse won't find it... 因此,Eclipse不会发现它并不奇怪...

There is no file under com.sun.faces.metadata.taglib for Friendly Markup and Passthrough, for both Glassfish and JBoss implementations. 对于Glassfish和JBoss实现, com.sun.faces.metadata.taglib下没有用于友好标记和传递的文件。

在此处输入图片说明

The question now is where should these files be? 现在的问题是这些文件应该在哪里?

Update: opened issue WFLY-9579 更新:已 打开问题WFLY-9579

It seems that the taglib files are missing from the implementation JARs, for both Glassfish and JBoss projects. 对于Glassfish和JBoss项目,实现JAR似乎缺少taglib文件。 I hope to be wrong but I found no other explanation. 我希望是错的,但没有找到其他解释。

在此处输入图片说明

I've posted a thread so this behavior can be investigated. 我已经发布了一个线程,以便可以调查此行为。

https://developer.jboss.org/thread/274046 https://developer.jboss.org/thread/274046

Workaround 解决方法

To stop the IDE from warning simply create empty taglibs files and associate to the web.xml . 要阻止IDE发出警告,只需创建空的taglibs文件并将其关联到web.xml Files should go under /WEB-INF/ and have the appropriate extension taglib.xml . 文件应位于/WEB-INF/并具有适当的扩展名taglib.xml

The JSF implementation will behave normally and should process the facelets correctly. JSF实现将正常运行,并且应该正确处理facelets。

friendly_markup.taglib.xml friendly_markup.taglib.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<facelet-taglib xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"
    version="2.2">
    <namespace>http://xmlns.jcp.org/jsf</namespace>
</facelet-taglib>

passthrough.taglib.xml passthrough.taglib.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<facelet-taglib xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"
    version="2.2">
    <namespace>http://xmlns.jcp.org/jsf/passthrough</namespace>
</facelet-taglib>

web.xml web.xml中

<context-param>
    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
    <param-value>/WEB-INF/passthrough.taglib.xml;/WEB-INF/friendly_markup.taglib.xml</param-value>
</context-param>

Here is what it looks like. 这是它的样子。 Now the warnings are gone (and my OCD is calm again). 现在警告消失了(我的OCD再次平静了)。 I would like to try and make JAR dependency for it, if I find some spare time. 如果有闲暇时间,我想尝试使其具有JAR依赖性。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM