采用复合组件的新的标签属性不被Eclipse的自动完成shortcurt显示 [英] Properties of new tags using composite component are not displayed by Eclipse auto complete shortcurt

查看:364
本文介绍了采用复合组件的新的标签属性不被Eclipse的自动完成shortcurt显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发在Eclipse中使用JSF 2.0复合组件。我已经把我的XHTML标记文件里面资源文件夹中。

I have developed composite components using JSF 2.0 in Eclipse. I've been putting my XHTML tag files inside resources folder.

当我打<大骨节病> CTRL + <大骨节病>空格键盘,则不会显示该标签的属性。

When I hit ctrl + space in keyboard, the property of the tag are not displayed.

我找到了一些窍门告诉安装JBoss的工具,但没有奏效。

I found some tips told to install "Jboss tools" but didn't work.

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://xmlns.jcp.org/jsf/composite"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <cc:interface>
        <cc:attribute name="value"/>
        <cc:attribute name="label"/>
        <cc:attribute name="masculino" default="true"/>
    </cc:interface>

    <cc:implementation>
        <p:selectOneMenu value="#{cc.attrs.value}" label="#{cc.attrs.label}">
            <f:selectItem itemValue="#{null}"
                          itemLabel="#{cc.attrs.masculino ? lbl['LABEL.TODOS'] : lbl['LABEL.TODAS']}" />
            <f:selectItem itemValue="true" itemLabel="#{lbl['LABEL.SIM']}" />
            <f:selectItem itemValue="false" itemLabel="#{lbl['LABEL.NAO']}" />
        </p:selectOneMenu>                                  
    </cc:implementation>

</html>

以上是创建一个标签的一个例子。

Above is one example of one tag created.

感谢

推荐答案

JSF 2.x的Facelets支持集成在的的Eclipse IDE的Java EE开发(注意 EE ,因此没有Eclipse IDE的Java开发人员),因为Eclipse的赫利俄斯(3.6版,2010年6月发布)。你需要确保的的JavaServer Faces的面被启用的项目构面的和项目属性的部分被设置为最低的2.0版本。

JSF 2.x Facelets support is integrated in "Eclipse IDE for Java EE developers" (note the EE, thus not "Eclipse IDE for Java developers"), since Eclipse Helios (version 3.6, released June 2010). You need to ensure that the JavaServer Faces facet is enabled in Project Facets section of project's properties and is set to a minimum of version 2.0.

在这里输入的形象描述

这在通常期间可配置,新的动态Web项目的向导,但在导入非Eclipse项目时或创建非的动态Web项目的项目(如Maven原型)那么你需要手动检查/添加。

This is usually configureable during in new Dynamic Web Project wizard, but when importing non-Eclipse projects or creating non-Dynamic Web Project projects (e.g. Maven archetypes), then you need to manually check/add it.

一旦整合,JSF标签自动完成是通过在 java.sun.com XML命名空间可用的默认。

Once integrated, JSF tag autocomplete is by default available on java.sun.com XML namespace.

在这里输入的形象描述

新的 xmlns.jcp.org 命名空间是不是默认(当前测试的Eclipse版本是月神SR2)。

The new xmlns.jcp.org namespace isn't recognized by default (currently tested Eclipse version is Luna SR2).

在这里输入的形象描述

如果您添加一个物理JSF 2.2实现在一个完全成熟的Java EE容器的味道不必建立路径的新的 xmlns.jcp.org 命名空间只会工作JSF 2.2及其模块,通过一个体面的服务器插件集成,并设置为目标运行时的项目的属性,或 / WEB-INF / lib目录<具体JSF 2.2实现JAR文件/ code>在Tomcat和克隆的情况下(或者可以将其作为一个Maven的依赖)。

The new xmlns.jcp.org namespace will only work if you've added a physical JSF 2.2 implementation to build path in flavor of a full fledged Java EE container having JSF 2.2 in its modules, integrated via a decent server plugin and set as Targeted Runtimes in project's properties, or a concrete JSF 2.2 implementation JAR file in /WEB-INF/lib in case of Tomcat and clones (or by adding it as a Maven dependency).

在这里输入的形象描述

它只是仍然无法在新的XML命名空间识别复合材料。当变回 java.sun.com ,复合成分标签code完成是回来了,但属性对这些标记code完成不可用。

It only still doesn't recognize composites in the new XML namespace. When changing back to java.sun.com, code completion of composite component tags is back, but code completion of attributes on those tags is not available.

在这里输入的形象描述

然后我安装 JBoss的工具4.2.3适用于Eclipse红月并启用的 JBoss的工具知识库的项目的属性。

Then I installed JBoss Tools 4.2.3 for Eclipse Luna and enabled the JBoss Tools Knowledge Base in project's properties.

在这里输入的形象描述

关闭并重新打开一个facelet后(所以JBoss的内置HTML编辑器被打开,你可以设置/配置通过单击鼠标右键使用的编辑器,的打开方式的),并切换到的来源标签(请不要使用的视觉的编辑器,这是一场灾难),我终于得到了code attribtues对复合材料部件完成。

After closing and reopening the Facelet (so JBoss builtin HTML editor gets opened; you can set/configure the editor used by rightclick, Open With), and switching to the Source tab (please don't use Visual editor, this is a disaster), I finally got code completion of attribtues on composite components.

在这里输入的形象描述

只有 xmlns.jcp.org 仍然没有奏效。这是一个Eclipse的具体问题,并可能已经固定在火星或更高版本。您可以随时隐藏下面的自定义XML命名空间背后的复合命名空间:

Only the xmlns.jcp.org still didn't work. It's an Eclipse specific issue and probably already fixed in Mars or newer. You can always hide the composite namespace behind a custom XML namespace as below:

/WEB-INF/my.taglib.xml

<?xml version="1.0" encoding="UTF-8"?>
<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://example.com/my</namespace>
    <composite-library-name>components</composite-library-name>
</facelet-taglib>

/WEB-INF/web.xml

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

在这里输入的形象描述

所以,总结如下:


  • 在复合标签启用项目为code竣工物业项目JSF方面。

  • 在复合标签上attribtues安装JBoss的工具为code完成。

  • 启用在项目属性JBoss的工具知识库。

  • 您也可以在构建路径为 xmlns.jcp.org 标准标签的支持物理JSF 2.2 implement执行JAR。

  • 使用 java.sun.com XML命名空间域或复合标签自定义标签库(或更新的Eclipse版本)。

  • Enable JSF project facet in project's properties for code completion on composite tags.
  • Install JBoss Tools for code completion on attribtues in composite tags.
  • Enable JBoss Tools Knowledge base in project's properties.
  • Have a physical JSF 2.2 impl JAR in buildpath for xmlns.jcp.org support on standard tags.
  • Use java.sun.com XML namespace domain or a custom taglib (or a newer Eclipse version) on composite tags.

这篇关于采用复合组件的新的标签属性不被Eclipse的自动完成shortcurt显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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