<%@ page contentType="text/html;charset=GB2312" %> <!--jsp-->
<%@page import="java.util.Date"%>
<%!
Date date;
int sum;
public int getFactorSum(int n){
for(int i=1;i<n;i++){
if(n%i==0)
sum=sum+i;
}
return sum;
}
%>
<html>
<head>
<title>hello android!</title>
</head>
<body bgcolor=yellow>
<font size=3>
<% date=new Date();
out.println("<br>"+date+"<br>");
int m=100;
%>
<%=m%>
的因子之和是<%= getFactorSum(m) %>
<% sum=0;%>
</font>
</body>
</html>
虽说照课本编的 但是解决了个bug 就是这东西啦 <% sum=0;%>