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

查看:243
本文介绍了http://java.sun.com/jsp/jstl/core和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行给出错误

Is there any difference between line-1 and line-2. line-2 in jsp file is not giving any error but line-1 in another jsp giving error


找不到标记库描述符
http://java.sun.com/jsp/jstl/core

我已经看到问题的解决方案这里但无法理解
什么是Facelets

I've seen the solution of the problem here but could not get understand what is "Facelets"


Facelets 1.x和2.x确实为
JSTL标记库使用了不同的名称空间。 Facelets 1.x
中的名称空间错误越来越少,并且已经为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.

  • 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.

您可以在Facelets中找到所有Facelets 2.x标签标签库
文档。 Facelets不附带完整标记设置为真正的
JSTL标记库。只有少数< c:xxx> 和全套< fn:xxx>
被复制到Facelets中。 < fmt:xxx> < sql:xxx> < xml :xxx> 标签
不会在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.


推荐答案

如果您正在使用(使用 JSTL 1.2

If you are using (uses JSTL 1.2)

< %@ taglib prefix =curi =http://java.sun.com/jsp/jstl/core%>

意味着使用您不需要的EL表达式< c:out> 。你可以直接在jsp页面上插入EL表达式,如 $ {propertyName}

means to use EL Expressions you do not need <c:out>. You can directly insert EL expressions onto jsp page like ${propertyName}

使用时(使用 JSTL 1.0 已弃用)

<%@ taglib prefix =curi =http:/ /java.sun.com/jsp/core%>

您无法直接在jsp页面上使用EL Expressions c为C:出> 。页面上的EL表达式不起作用。例如< c:out value =$ {propertyName}>

You can not use EL Expressions directly on jsp page you need <c:out>. EL expressions on the page will not work. e.g. <c:out value="${propertyName}">.

此外,您的网络应用版本(在 web.xml 中找到)应降至2.3以使用 http://java.sun.com/jsp/core 这又太旧了。

Also your web-app version (found in web.xml) should be down to 2.3 to use http://java.sun.com/jsp/core which is again too old.

结论:

<%@ taglib prefix =curi =http://java.sun.com/jsp/jstl/core%> - 可以直接使用EL

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - Can use EL directly

<%@ taglib prefix =curi =http:// java.sun.com/jsp/core%> - 不能直接使用EL

<%@taglib prefix="c" uri="http://java.sun.com/jsp/core" %> - Can not use EL directly

这篇关于http://java.sun.com/jsp/jstl/core和http://java.sun.com/jstl/core之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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