JSF xmlns URI未在IntelliJ IDEA中注册 [英] JSF xmlns URI not registered in IntelliJ IDEA

查看:335
本文介绍了JSF xmlns URI未在IntelliJ IDEA中注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的JSF文件的开头:

Here is the start of my JSF file:

<?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:h="http://java.sun.com/jsf/html"
      xmlns:ace="http://www.icefaces.org/icefaces/components"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core">
<h:head>
</h:head>
<h:body>

然而, http://www.icefaces.org/icefaces/components http://java.sun.com/jsp/jstl/core 以红色突出显示,错误为 URI为未注册。这导致许多其他后续标记显示为红色,错误此处不允许元素x。这是一张显示我的意思的图片:

However, http://www.icefaces.org/icefaces/components and http://java.sun.com/jsp/jstl/core are highlighted in red with error URI is not registered. This causes many other subsequent tags to appear in red with errors element 'x' is not allowed here. Here is an image showing what I mean:

在搜索解决方案时,它出现了其他一些通过获取外部资源解决了同样的问题。但是,这对我不起作用。对于icefaces xmlns xmlns:ace =http://www.icefaces.org/icefaces/components我收到错误:获取时出错http://www.icefaces.org/icefaces/components 。对于jstl xmlns xmlns:c =http://java.sun.com/jsp/jstl/core我收到错误:该位置没有XML:http://java.sun.com/jsp/jstl/core

When searching for a solution, it appeared some others with the same problem solved it by doing "Fetch External Resource". However, this didn't work for me. For the icefaces xmlns xmlns:ace="http://www.icefaces.org/icefaces/components" I get the error: Error while fetching http://www.icefaces.org/icefaces/components. And for the jstl xmlns xmlns:c="http://java.sun.com/jsp/jstl/core" I get the error: No XML at the location: http://java.sun.com/jsp/jstl/core.

我还发现有些人解决了它通过删除 .idea 目录中的IntelliJ IDEA元数据文件 workspace.xml 。这似乎暂时起作用......但似乎问题在一段时间后回来了。我还必须重新配置我想避免的几个项目设置。

I also found some people solved it by deleting the IntelliJ IDEA metadata file workspace.xml in the .idea directory. This does seem to work temporarily... but then it seems the problem comes back after a while. I also have to reconfigure several project settings which I would like to avoid.

任何帮助都会受到赞赏..我不是很熟悉xmlns的东西,还是一个初学者到网络应用程序开发。谢谢!

Any help would be appreciated.. I'm not really familiar with the xmlns stuff and still a beginner to web app development. Thank you!

根据Mark Vedder的回答,我手动将外部资源添加到我的项目中到目前为止,这个问题还没有浮出水面。

As per Mark Vedder's answer, I manually added external resources to my project and the problem has not resurfaced thus far.

推荐答案

对于未注册的资源,第一个解决方案是使用获取外部资源quickfix 。如果失败,就像在这种情况下一样,(通常因为位置仅在名称中),您需要手动配置它。

With unregistered resources, the first solution is to use the "Fetch External Resource" quickfix. If that fails, as it has for you in this case, (usually because the "location" is in name only) you need to manually configure it.

手动配置


  1. 如果资源(即 .xsd .dtd 等)存在于您的某个库罐中,请跳至步骤2.否则,请下载该资源的副本。把它放在你系统上方便的地方。

  2. 在IDEA中,将光标指向错误,通过键入 Alt + Enter 打开快速修复/意向菜单,然后选择手动设置外部资源。 (如果您没有此选项(基于IntelliJ IDEA版本),请转到下一节以获取说明。)

  3. 如果资源位于jar中,请选择 Schemas 选项卡,然后从相应的jar中选择资源。如果您下载了它,请选择资源管理器标签(可能在Mac中命名为Finder)并导航到并选择您下载的文件。

  4. 单击确定,让IDEA为资源编制索引。

  1. If the resource (i.e. the .xsd, .dtd, etc.) exists in one of your library jars, skip to step 2. Otherwise, download a copy of the resource. Put it somewhere convenient on your system.
  2. In IDEA, with your cursor on the error, open the Quick Fix / Intentions menu by typing Alt+Enter and select "Manually Setup External Resource". (If you do not have this option (based on IntelliJ IDEA version) go to the next section for instructions.)
  3. If the resource is in a jar, select the Schemas tab and select the resource from the appropriate jar. If you downloaded it, select the Explorer tab (may be named Finder in Mac) and navigate to and select the file you downloaded.
  4. Click OK and let IDEA index the resource.

通过IDE设置编辑或设置


  1. 通过 Ctrl + Alt + 输入打开设置对话框或文件>设置。


    • 要配置所有未来的新项目,以便可以使用此模式,请通过文件>其他设置>默认设置

  1. Open the settings Dialog via Ctrl+Alt+Enter or File > Settings.
    • To configure for all future new projects so this schema is avaiable, open the similar dialog via File > Other Settings > Default Settings

更新

各种JSF Taglib定义(适用于JSF 2.x及更高版本)可以在 com.sun的 com / sun / faces / metadata / taglib 目录中找到.faces:jsf-impl jar。 jsf-impl JAR文件可以从 maven central 等等。

The various JSF Taglib definitions (for JSF 2.x and above) can be found in the com/sun/faces/metadata/taglib directory of the com.sun.faces:jsf-impl jar. The jsf-impl JAR file can be downloaded from maven central among other places.

这篇关于JSF xmlns URI未在IntelliJ IDEA中注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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