我有A级:
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>
当我运行它时,它会给出一个错误:
如果代替
<c:out value = "${a.x}" />
<jsp:getProperty property="x" name="a"/>
一切都很顺利。
那么,问题是什么?
提前谢谢。