带有 facelets (jsf) 和 xhtml 的 Eclipse 自动完成(内容辅助) [英] Eclipse autocomplete (content assist) with facelets (jsf) and xhtml

查看:34
本文介绍了带有 facelets (jsf) 和 xhtml 的 Eclipse 自动完成(内容辅助)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 facelets 在 .xhtml 页面中为 JSF (1.2) 标签激活 eclipse (3.5, WTP) 内容辅助?它适用于 .jsp 文件,但不适用于 xhtml.

我在谷歌上搜索了很多,在很多地方(包括 MyFaces wiki)都说-Eclipse 不能使用 xhtml 和 facelets"

由于这适用于 .jsp 文件,因此我假设可能存在某种机制来激活该内容辅助.

我开始着手一个项目,该项目已经有一个庞大的代码库,因此无法更改扩展.额外的插件也是不可取的,但如果没有其他效果可以接受.

(我问这个问题是为了验证是否有人没有找到解决此问题的机智解决方法 - 否则我知道这是不可能的)

解决方案

在提出问题后很快找到了解决方案(并且在我开始尝试解决问题一个小时后):

<代码>窗口 >首选项 >一般>内容类型文本 >JSP>添加(xhtml)

使文件被视为jsp文件.因此,当它们用 JSP 编辑器打开时,任何具有 .tld 格式(<h:<f 例如)工作.Facelets 和 facelets-only 标签仍然不起作用.它们的 .tld 等效项应该添加到项目中的某处.可以在此处找到 Facelet 的 tld.>

另一种更复杂的解决方案在here中描述.

How to activate eclipse (3.5, WTP) content assist in .xhtml pages for JSF (1.2) tags, using facelets? It works in .jsp files, but not xhtml.

I google a lot, and in many places (including MyFaces wiki) it is said - "Eclipse can't work with xhtml and facelets"

Since this works with .jsp files, I assume there might be some mechanism with which to activate that content assist.

I started working on a project, which has already a large codebase, so changing the extensions is not an option. Additional plugins are aslo undesirable, but acceptable if nothing else works.

(I'm asking the question to verify if someone hasn't found a witty workaround to this issue - otherwise I know it's not possible)

解决方案

Found the solution pretty quickly after asking the question (and an hour after I started attempting to solve it):

Window > Preferences > General > Content Types > Text > JSP > Add (xhtml)

Makes the files be treated as jsp ones. Thus when they are opened with the JSP editor, the autocomplete of any tag library that has its definitions in .tld format (<h: and <f for example) works. Facelets, and facelets-only tags still don't work. Their .tld equivalents should be added somewhere in the projects. Facelet's tld can be found here.

Another, a bit more complex solution is described here.

这篇关于带有 facelets (jsf) 和 xhtml 的 Eclipse 自动完成(内容辅助)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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