java 如何使用 <c:out value=...> 标签库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/3028922/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use <c:out value=...> taglib
提问by artaxerxe
I have the class A:
我有A类:
package a;
public class A {
private int x = 9;
public int getX() {
    return x;
}
}
and the ajsp.jsp file:
和 ajsp.jsp 文件:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<jsp:useBean id = "a" class = "a.A" />
<c:out value = "${a.x}" />
</body>
</html>
when i run it, it gives an error :
当我运行它时,它给出了一个错误:
- org.apache.jasper.JasperException: /ajsp.jsp(11,0) PWC6236: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
 
- org.apache.jasper.JasperException:/ajsp.jsp(11,0) PWC6236:根据标记文件中的 TLD 或属性指令,属性值不接受任何表达式
 
if instead of <c:out value = "${a.x}" />i use <jsp:getProperty property="x" name="a"/>it goes perfect. 
So, what is the problem?
Thank advance.
如果不是<c:out value = "${a.x}" />我使用<jsp:getProperty property="x" name="a"/>它就完美了。那么,问题是什么?先谢过。
回答by skaffman
Your taglib URI is incorrect, you're using the URI of the old pre-expression, pre-JSP 2.0 library.
您的 taglib URI 不正确,您使用的是旧的 pre-expression、pre-JSP 2.0 库的 URI。
Instead of
代替
it should be
它应该是

