假设我有一个static final int
字段的类,我在jsp页面中导入了一个类:
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="com.mycompany.Object" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
The static field with EL is: ${Object.STATIC_FIELD} <br />
The static field with Scriptlet is: <%=Object.STATIC_FIELD%> <br />
El and pageScope (doesnt work either): ${pageScope.Object.STATIC_FIELD}
</body>
</html>
使用scriptlet进行访问,但不能使用EL。