如何在我的 xhtml 页面中重新激活代码辅助(eclipse 3.5、jboss tools 3.1、jsf 1.2)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2058175/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:18:24  来源:igfitidea点击:

How to reactivate code assist in my xhtml page (eclipse 3.5, jboss tools 3.1, jsf 1.2)

eclipsejsfautocompletejboss-toolscontent-assist

提问by Maxime ARNSTAMM

I develop jsf xhtml pages with facelets, and I always had code assist for all the taglibs i declared i my xhtml root element (h, f etc..)

我使用 facelets 开发 jsf xhtml 页面,并且我总是为我声明的所有 taglib 提供代码帮助,我的 xhtml 根元素(h、f 等)

But, since, like 30 minutes, when i ctrl+space i only have regular html and ui:* proposals.

但是,因为像 30 分钟一样,当我按 ctrl+space 时,我只有常规的 html 和 ui:* 建议。

I didn't change anything. It just broke, no error message, nothing.

我没有改变任何东西。它只是坏了,没有错误消息,什么都没有。

I searched the web, but nothing either, or i am not searching right.

我搜索了网络,但也没有,或者我搜索不正确。

Please help me :)

请帮我 :)

ps : here's an example of one of my xhtml page's header :

ps:这是我的 xhtml 页面标题之一的示例:

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" 
 xmlns:ui="http://java.sun.com/jsf/facelets" 
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:f="http://java.sun.com/jsf/core" 
 xmlns:a4j="http://richfaces.org/a4j" 
 xmlns:r="http://richfaces.org/rich"
 xmlns:c="http://java.sun.com/jstl/core"
 xmlns:s="http://jboss.com/products/seam/taglib">

回答by kinkajou

  1. Right click on the project, choose properties, select “Project Facets“, make sure the “JavaServer Faces” is checked. If it is checked go to step 2.

  2. Create an user library and include the JSF API and implementation library, jsf-api-xxx.jar and jsf-impl-xxx.jar. It will add the JSF capabilities to your project.

  1. 右键单击项目,选择属性,选择“Project Facets”,确保选中“JavaServer Faces”。如果选中,请转到步骤 2。

  2. 创建用户库并包含 JSF API 和实现库 jsf-api-xxx.jar 和 jsf-impl-xxx.jar。它会将 JSF 功能添加到您的项目中。

If you don't understand click: http://www.mkyong.com/jsf2/eclipse-ide-xhtml-code-assist-is-not-working-for-jsf-tag/

不明白点击:http: //www.mkyong.com/jsf2/eclipse-ide-xhtml-code-assist-is-not-working-for-jsf-tag/

Best Regards.

此致。

回答by McDowell

Firstly:

首先:

  1. Check the content assistoptions.
  2. Check the Error Logand search for any messages you suspect are related. As well as Google, check bugs.eclipse.org.
  1. 检查内容辅助选项。
  2. 检查错误日志并搜索您怀疑相关的任何消息。除了谷歌,检查bugs.eclipse.org

It hasn't been unknown for bugs to leave workspaces with cached state that can adversely affect behaviour. You can try these tricks:

众所周知,错误会使工作区处于缓存状态,从而对行为产生不利影响。你可以试试这些技巧:

  1. Close and reopenthe affected project.
  2. Start the workspace with the -cleanoption.
  3. Deletethe project (but not contents under!) and reimportit as an existing project.
  4. If the workspace is caching something broken, you may be able to delete it by poking around in the workspace/.metadata/.pluginsdirectory. Most of that stuff is fairly transient (though backup first and watch for deleted preferences).
  1. 关闭并重新打开受影响的项目。
  2. 使用-clean选项启动工作区。
  3. 删除项目(但不是!下的内容)并将其重新导入为现有项目。
  4. 如果工作区正在缓存损坏的内容,您可以通过在工作区/.metadata/.plugins目录中查找来删除它。大多数东西都是相当短暂的(尽管先备份并注意删除的首选项)。

回答by jcasalruiz

Adding xhtml to JSP content types worked for me. Window > Preferences > General > Content Types > Text > JSP.

将 xhtml 添加到 JSP 内容类型对我有用。窗口 > 首选项 > 常规 > 内容类型 > 文本 > JSP。

回答by Maxime ARNSTAMM

Ok, here's the solution that worked for me :

好的,这是对我有用的解决方案:

ProjectWebApp > properties > Projet Facets > switched "Java 5.0" to 6.0

ProjectWebApp > 属性 > Projet Facets > 将“Java 5.0”切换到 6.0

That did the trick.

这就是诀窍。

回答by Valerij Timofeev

My solution for similar problem when migrating from the JBoss Developer Studio version 1 to version 3:

我在从 JBoss Developer Studio 版本 1 迁移到版本 3 时针对类似问题的解决方案:

Check xmlns entries, they should look as follows:

检查 xmlns 条目,它们应如下所示:

...
xmlns:a="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">

The old ones in my case were:

在我的情况下,旧的是:

...
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:a="https://ajax4jsf.dev.java.net/ajax">