http://java.sun.com/jsp/jstl/core 和 http://java.sun.com/jstl/core 的区别
Difference between http://java.sun.com/jsp/jstl/core and http://java.sun.com/jstl/core
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> //line-1
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c1" %> //line-2
1号线和2号线有区别吗? jsp 文件中的第 2 行没有给出任何错误,但另一个 jsp 中的第 1 行给出错误
Can not find the tag library descriptor for
"http://java.sun.com/jsp/jstl/core"
我看到了问题的解决方法here但是没看懂
什么是 "Facelets"
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.
- The real JSTL 1.0 taglib uses the URI http://java.sun.com/jstl/core.
- The real JSTL 1.1/1.2 taglib uses the URI http://java.sun.com/jsp/jstl/core.
- Facelets 1.x uses the URI http://java.sun.com/jstl/core.
- Facelets 2.x uses the URI http://java.sun.com/jsp/jstl/core.
- Facelets 2.2+ uses the URI http://xmlns.jcp.org/jsp/jstl/core.
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.
如果您正在使用(使用 JSTL 1.2
)
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
表示使用不需要的 EL 表达式<c:out>
。您可以直接将 EL 表达式插入 jsp 页面,如 ${propertyName}
使用时(使用 JSTL 1.0
已弃用)
<%@taglib prefix="c" uri="http://java.sun.com/jsp/core" %>
您不能在您需要 <c:out>
的 jsp 页面上直接使用 EL 表达式。页面上的 EL 表达式将不起作用。例如<c:out value=”${propertyName}”>
。
此外,您的网络应用程序版本(在 web.xml
中找到)应降至 2.3 才能使用 http://java.sun.com/jsp/core
,这又太旧了。
结论:
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- 可以直接使用EL
<%@taglib prefix="c" uri="http://java.sun.com/jsp/core" %>
- 不能直接使用EL
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> //line-1
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c1" %> //line-2
1号线和2号线有区别吗? jsp 文件中的第 2 行没有给出任何错误,但另一个 jsp 中的第 1 行给出错误
Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
我看到了问题的解决方法here但是没看懂 什么是 "Facelets"
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.
- The real JSTL 1.0 taglib uses the URI http://java.sun.com/jstl/core.
- The real JSTL 1.1/1.2 taglib uses the URI http://java.sun.com/jsp/jstl/core.
- Facelets 1.x uses the URI http://java.sun.com/jstl/core.
- Facelets 2.x uses the URI http://java.sun.com/jsp/jstl/core.
- Facelets 2.2+ uses the URI http://xmlns.jcp.org/jsp/jstl/core.
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.
如果您正在使用(使用 JSTL 1.2
)
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
表示使用不需要的 EL 表达式<c:out>
。您可以直接将 EL 表达式插入 jsp 页面,如 ${propertyName}
使用时(使用 JSTL 1.0
已弃用)
<%@taglib prefix="c" uri="http://java.sun.com/jsp/core" %>
您不能在您需要 <c:out>
的 jsp 页面上直接使用 EL 表达式。页面上的 EL 表达式将不起作用。例如<c:out value=”${propertyName}”>
。
此外,您的网络应用程序版本(在 web.xml
中找到)应降至 2.3 才能使用 http://java.sun.com/jsp/core
,这又太旧了。
结论:
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- 可以直接使用EL
<%@taglib prefix="c" uri="http://java.sun.com/jsp/core" %>
- 不能直接使用EL