JSF 1.2 和 JSF 2.x 之间的 JSTL xmlns 命名空间差异? [英] JSTL xmlns namespace differences between JSF 1.2 and JSF 2.x?

查看:25
本文介绍了JSF 1.2 和 JSF 2.x 之间的 JSTL xmlns 命名空间差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于 JSF 1.2 的 web 应用程序,我从中复制了 JSTL 导入

I have a JSF 1.2 based webapp from which I copied the JSTL import

xmlns:c="http://java.sun.com/jstl/core"

你也可以在互联网上的很多地方找到这个导入.我不记得以上是否在我以前的 Web 项目中有效,无论如何,它在我当前基于 JSF 2.0 的 Web 应用程序中无效.我从容器收到警告说:

You can also find this import in many places on the Internet. I can't remember whether the above worked in my former web project or not, in any case, it does not work in my current JSF 2.0 based webapp. I got a warning from the container saying:

警告:此页面调用 XML 命名空间 http://java.sun.com/jstl/core 声明为前缀 c 但该命名空间不存在标签库.

Warning: This page calls for XML namespace http://java.sun.com/jstl/core declared with prefix c but no taglibrary exists for that namespace.

然后我将导入更改为

xmlns:c="http://java.sun.com/jsp/jstl/core"

... 在基于 JSF/RichFaces 的 web 应用程序中使用 消除了所有令人头疼的问题.

... which removed all headaches using <c:forEach> in a JSF/RichFaces-based webapp.

这里有什么技巧?JSTL 导入 URL 从 JSF 1.2 到 2.x 是否有任何更改?还是前一行通常是错误的(在 JSF 中)?两者有什么区别?

What's the trick here? Have there been any changes to the JSTL import URL from JSF 1.2 to 2.x? Or is the former line generally wrong (in JSF)? What's the difference between the two?

推荐答案

查看我们的 JSTL wiki 页面:https://stackoverflow.com/tags/jstl/info 每当您将鼠标悬停在 标记在您的问题下方,直到弹出一个黑框,然后单击信息链接.

Check our JSTL wiki page: https://stackoverflow.com/tags/jstl/info You can get this kind of page whenever you hover the jstl tag below your question until a black box pops up and then click the info link.

Facelets 1.x 和 2.x 确实为 JSTL 标记库使用了不同的命名空间.它或多或少是 Facelets 1.x 中的一个命名空间 bug 并且已针对 Facelets 进行了修复2.x.

It is true that Facelets 1.x and 2.x uses different namespaces for the JSTL tag library. It was less or more a namespace bug in Facelets 1.x and has been fixed for Facelets 2.x.

  • 真正的 JSTL 1.0 taglib 使用 URI http://java.sun.com/jstl/core.
  • 真正的 JSTL 1.1/1.2 taglib 使用 URI http://java.sun.com/jsp/jstl/core.
  • Facelets 1.x 使用 URI http://java.sun.com/jstl/core.
  • Facelets 2.x 使用 URI http://java.sun.com/jsp/jstl/core.
  • Facelets 2.2+ 使用 URI http://xmlns.jcp.org/jsp/jstl/core.

您可以在 中找到所有 Facelets 2.x 标签Facelets 标记库文档.Facelets 不附带作为 真正的 JSTL 标记库.只有少数 和完整的 集被复制到 Facelets 中. 标签不会在 Facelets 中被接管.

You can find all Facelets 2.x tags in the Facelets tag library documentation. Facelets don't ship with the full tag set as the real JSTL taglib. Only a few of the <c:xxx> and the full set of <fn:xxx> are copied into Facelets. The <fmt:xxx>, <sql:xxx> and <xml:xxx> tags are not taken over in Facelets.

这篇关于JSF 1.2 和 JSF 2.x 之间的 JSTL xmlns 命名空间差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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