【问题标题】:JSF 2.2 namespace not found未找到 JSF 2.2 命名空间
【发布时间】:2013-08-31 16:28:04
【问题描述】:

我想使用 JSF 2.2 的 f:viewAction,但它不起作用。

我的面孔配置:

<faces-config version="2.2"
    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-facesconfig_2_2.xsd">

xhtml 定义:

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

    <f:metadata>
        <f:viewAction action="#{bean.welcomeUser()}" onPostback="false"  />
    </f:metadata>

...

</html>

问题在于它强调了 f、h 和 ui 命名空间(带有警告:NLS 缺失消息:CANNOT_FIND_FACELET_TAGLIB 在: org.eclipse.jst.jsf.core.validation.internal.facelet.messages)

我该怎么做才能让它再次工作? (我已经包含了 myfaces-impl-2.2.0 和 myfaces-api-2.2.0)

编辑: 当我在我的项目中包含 jsf impl 2.2 和 api 2.2 时,警告消失了,但随后编译出现了大问题(找不到工厂等)

【问题讨论】:

  • 你的设置是什么(服务器/框架/什么)?
  • 你在使用 Eclipse 吗?
  • 你为什么发布未完成的faces-config.xml
  • 是的,我使用 eclipse 和 tomcat 7, faces-config 里面没有什么有趣的,想象一下它是完整的
  • 如果您绝对肯定 JSF 已正确安装,那么这些警告是无害的。这只是 Eclipse 的另一个愚蠢之处。如果你仍然运行代码会发生什么?另请参阅 this duplicate question,其答案被 kocko 复制粘贴并改写。

标签: jsf namespaces jsf-2.2


【解决方案1】:

您描述的行为在 MyFaces 2.2.8 中仍然存在,f:viewAction 的问题是众所周知的。它应该在 Eclipse 3.7.2 (Mars.2) 和 MyFaces 2.2.9 中修复。

标签没有 Eclipse 自动完成功能,但实际上可以按预期使用它。

参考:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-16
    • 2019-11-20
    • 1970-01-01
    • 1970-01-01
    • 2019-03-03
    • 1970-01-01
    • 2012-03-31
    相关资源
    最近更新 更多