JAR中的JSF组合组件在NetBeans中无法识别 [英] JSF composite components in JAR not recognised in NetBeans

查看:142
本文介绍了JAR中的JSF组合组件在NetBeans中无法识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中添加了一个常用的JAR。 jar看起来像......

I have added a common JAR to my project. The jar looks something like...

CommonWeb.jar
 |-- META-INF
 |    |-- resources
 |    |    `-- common
 |    |         |-- css
 |    |         |    `-- my.css
 |    |         |-- js
 |    |         |    `-- my.js
 |    |         |-- images
 |    |         |    `-- my.png
 |    |         |-- components
 |    |         |    `-- mycomposite.xhtml
 |    |         `-- templates
 |    |              `-- mytemplate.xhtml
 |    |-- faces-config.xml
 |    `-- MANIFEST.MF
 :

一切正常,但Netbeans不会识别我的复合部件。试图使用该组件的页面看起来像这样......

Everything is working except that Netbeans will not recognise my composite component. The page trying to use the component looks something like this...

<ui:composition template="/resources/common/templates/mytemplate.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:cmn="http://java.sun.com/jsf/composite/common/components">

    <ui:define name="content">
        ...
        <cmn:mycomposite ... />
        ...
    </ui:define>
</ui:composition>

项目将编译运行,无后顾之忧。但是IDE在< cmn:mycomposite ... /> 上给了我红色的波浪线,并且没有自动完成等等。如果我复制它将全部正常工作将组件放入项目自己的资源文件夹中,所以似乎netbeans只是没有找到jar。

The project will compile and run, no worries. But the IDE gives me red squiggly lines on <cmn:mycomposite ... /> and does not auto-complete, etc. It will all work fine if I copy the component into the project's own resources folder, so it seems netbeans just isn't looking to the jar.

有很多类似问题的问题,例如:

There are quite a few questions around with similar problems, eg:

......但没有令人满意的解决方案或解决方法。

...but there are no satisfactory solutions or workarounds.

此外还有一些关于此事的netbeans错误报告,但这些似乎都是固定的

Also there have been a few netbeans bug reports on the matter but these all seem to be 'fixed'

是否有一些我缺少的配置?有没有人真正设法使用最新版本的NetBeans(编写本文时的NetBeans 7.4补丁2)?有没有人找到一个实际有用的解决办法?

Is there some configuration that I'm missing? Has anyone actually managed to get this working with the latest version of NetBeans (NetBeans 7.4 Patch 2 at time of writing)? Has anyone found a work-around that actually works?

更新:

NetBeans 8中继续出现此问题

This problem continues to occur in NetBeans 8

推荐答案

此问题仅限IDE问题,并在版本8.1中继续。它源于 Netbeans bugzilla 中发现的错误 - 特别是在JSF编辑器中XHTML模块(org.netbeans.modules.web.jsf.editor)

This issue is an IDE only issue and continues in version 8.1. It stems from the bug identified in Netbeans bugzilla - specifically in the "JSF Editor for XHTML" module (org.netbeans.modules.web.jsf.editor)

我通过下载Netbeans的8.1版源文件并自己应用建议的补丁解决了这个问题。我猜这是早期版本中的类似问题,但我没有检查过。

I resolved the issue by downloading the version 8.1 source files for Netbeans and applying the suggested patch myself. I'm guessing it's a similar issue in earlier versions but I didn't check this.

要下载和编译Netbeans,你可以按照这里

To download and compile Netbeans you can follow the "How To" in here

摘要变更:

CompositeComponentModel.java第296行更改为:

CompositeComponentModel.java line 296 changed to:

if (parent != null && parent.getName().equalsIgnoreCase("META-INF")) { //NOI18N

JsfBinaryIndexer.java第74行更改为:

JsfBinaryIndexer.java line 74 changed to:

namePattern = ".*\\.tld|.*\\.taglib\\.xml|.*\\.xhtml",

索引器版本在第81行递增更改为:

Indexer version incremented on line 81 changed to:

static final int INDEXER_VERSION = 11; //NOI18N

鉴于正在跟踪该错误,希望它能够进入下一个版本。

Given that the bug is being tracked hopefully it makes it into the next release.

这篇关于JAR中的JSF组合组件在NetBeans中无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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