我有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"/>
,那就完美了。
那么,问题是什么?
谢谢提前。
答案 0 :(得分:8)