该程序实现的是:
编写一个JSP程序,使用JSP Script显示网页上如下颜色的颜色条:绿色、蓝绿色、黑色、红色、黄色、以及粉红色(对应的颜色为:Green、Cyan、Black、Red、Yellow、Pink)
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="java.util.ArrayList"%>
<html>
<head>
<title>Title</title>
</head>
<body>
<%
String[] color={"Green","Cyan","Black","Red","Yellow","Pink"};
for(int i=0;i<color.length;i++) {
%>
<hr color=<%=color[i] %>></hr> <%-- <hr>标签在页面中创建一条水平线--%>
<%}%>
</body>
</html>
结果如下图所示: