IncludeFile.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Jie Cheng</title>
</head>
<body>
<font size =2>
<table border=1>
<tr>
<th> Lei Jia</th>
</tr>
<tr>
<td><jsp:include page="IncludeFile1.jsp"></jsp:include></td>
</tr>
</table>
</font>
</body>
</html>
IncludeFile1.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>阶乘和</title>
</head>
<body>
<p>请输入一个正整数:
<form action="" method=post name=form>
<input type="text" name ="ok" ></form>
<%
String a=request.getParameter("ok");
if(a==null){
a="0";
}
else{
int n=Integer.parseInt(a);
int sum=1;int s=0;
for(int i=1;i<=n;i++){
sum=sum*i;
s=s+sum;
}
out.print("BR"+"总和:"+s);
}
%>
</body>
</html>