JSP第一周作业
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> 求1-100的偶数和? <hr> <br> </body> <% int sum = 0; for(int i=0;i<100;i++){ if(i%2==0){ sum+=i; } } %> 1-100中间的偶数和是: <%=sum%> </html>