JSF2 的内容辅助 + CDI(焊接)豆 +日食赫利俄斯

发布于 2024-10-01 06:46:06 字数 303 浏览 0 评论 0原文

我尝试在 eclipse helios 中使用 JSF2 CDI(焊接)bean,而不是 ManagedBeans,但无法在我的 Named beans 的表达式语言中执行自动完成(#{myNamedBean.Ctrl+Space} 之类的)

但是 OTOH 使用 ManagedBeans,内容辅助效果很好.. Eclipse Helios 是否支持 CDI bean 的内容辅助?

有人有这方面的经验吗?

Im trying JSF2 CDI (weld) beans in eclipse helios instead of ManagedBeans, but can't do the auto completion inside the expression language for my Named beans (the #{myNamedBean.Ctrl+Space} thingy)

But OTOH with ManagedBeans, the content assist works well ..
Is the content assist for CDI beans supported yet in Eclipse Helios?

Anybody got experiences in this ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

滥情空心 2024-10-08 06:46:06
  1. 安装JBoss 工具。然后将 org.jboss.tools.jsf.jsfnature 添加到 .project 文件的 natures 部分,我的 Eclipse J2EE Helios 版本中的支持得到了改进。 (此步骤可能相当于项目设置中的Configure->Add JSF Capability。)上下文完成随后适用于cc.attrs。构建组件组合时,但遗憾的是仍然不适用于任何 @ManagedBean

  2. 从 ManagedBeans 切换到 CDI:我将所有 @ManagedBean 更改为 @javax.inject.Named,并将范围更改为 @javax.enterprise.context。 *Scoped 等。我还在项目设置中启用了 CDI 支持。然后我在 .xhtml 中获得了有关 beans 的上下文完成!

第一个限制:它仅在 EL 是属性值的一部分时才起作用。如果您只是在 .xhtml 页面上的其他地方使用 #{EL} ,它就不起作用。

第二个限制:如果您通过常量定义 bean 的名称,则上下文竞争无法识别它:不起作用:@Named(value = MyBean.BEANNAME)。您必须将名称设置为字符串,例如:@Named(value = "myBean")

第三个限制:如果您使用参数化方法调用(例如使用 Tomcat7 或 Glassfish),则不受支持自动完成。自动完成仅显示 bean 的 get/set/is 属性。

注意:它在 Netbeans 7 中开箱即用。

  1. Install JBoss tools. Then by adding <nature>org.jboss.tools.jsf.jsfnature</nature> to the natures section of the .project file, the support improved in my Eclipse J2EE Helios edition. (This step is probably equal to Configure->Add JSF Capabilities in the project settings.) The context completion then works for cc.attrs.<ctrl-space> when building component compositions, but sadly still not for any @ManagedBeans.

  2. Switch from ManagedBeans to CDI: I changed all @ManagedBeans to @javax.inject.Named and the scopes to @javax.enterprise.context.*Scoped etc. I also enable CDI Support in the project settings. Then I get context completion on beans in .xhtml!

First limitation: It only works when the EL is part of an attribute value. It does not work if you just use #{EL} somewhere else on the .xhtml page.

Second limitation: If you define the name of your bean via a constant, it is not recognized for context competion: Does not work: @Named(value = MyBean.BEANNAME). You have to set the name as a String, like: @Named(value = "myBean")

Third limitation: If you use parameterised method calls (e.g. with Tomcat7 or Glassfish), this is not supported by autocomplete. The autocomplete only shows get/set/is properties of the bean.

Note: It works out of the box in Netbeans 7.

超可爱的懒熊 2024-10-08 06:46:06

如果有任何支持,则来自 JBoss Tools

If there is any support, it would be from JBoss Tools.

狼性发作 2024-10-08 06:46:06

在安装 JBossTools 之前,请注意,对于 EL 自动完成支持和托管 Bean 映射,您所需要的只是 JBoss 工具集中的这 2 个组件。

1. JBoss Tools JSF
2. JBoss Tools Visual Page Editor

如果您不选择这些特定工​​具,那么所有 20 多个工具都将被安装。

另请注意,有时您的默认文件 *.xhtml 关联在工具安装后不会更改。您可能必须手动更改文件关联首选项。 File>Preference>File Associations。 选择 *.xhtml 并将“JBoss Tools Visual Page Editor”设置为默认编辑器。

Before you install JBossTools, please note that for EL auto complete support and managed bean mapping all you need is these 2 components from the JBoss Tool set.

1. JBoss Tools JSF
2. JBoss Tools Visual Page Editor

If you do not select these specific tools then all the 20+ tools will get installed.

Also, note that sometimes your default file *.xhtml association will not change after tool installation. You may have to manually change file association preference. File>Preference>File Associations. Select *.xhtml and set "JBoss Tools Visual Page Editor" as the default editor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文