<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*" errorPage="" %> <html> <head> <title>JSP练习</title> </head> <body> <% int sum = 0, i, j; for (i = 1; i <= 7; i++){ %> <font color="red" size="<%=i%>"> <b>大家好!</b> </font> <% sum += i; }//for if (sum % 2 == 0){ out.print("<br><b>" + sum + "</b>"); %> <b>是偶数.</b> <% } else{ out.print("<br><b>" + sum + "<b>"); %> <b>是奇数.</b> <% } %> </body> </html>