1、
2、jsp页面是可以访问枚举类型,实例代码如下:
枚举Color.java
public enum Color {
WHITE, RED, BLACK;
}
index.jsp页面:
<%@ page language="java" import="java.util.*,com.lqh.model.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
<%
Color c = Color.RED;
System.out.println(c);
%>
</body>
</html>