package a;
public class A {
private int x = 9;
public int getX() {
return x;
}
}
和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>
當我運行它,它給出了一個錯誤:
- org.apache.jasper.JasperException:/ajsp.jsp(11,0)PWC6236:根據TLD或屬性在標籤文件指令,屬性值不接受任何表情
如果不是<c:out value = "${a.x}" />
我使用<jsp:getProperty property="x" name="a"/>
它完美。 那麼,這是什麼問題? 感謝提前。
您使用該JSTL標籤庫的版本? – mdma 2010-06-12 14:07:42