main.jsp
<%@ page contentType="text/html;charset=GB2312" %>
<HTML><BODY bgcolor=yellow>
<FONT Size=6>
<%
double a=2;
double b=4;double h=3;
%>
<jsp:include page="lader.jsp">
<jsp:param name="top" value="<%= a%>"/>
<jsp:param name="bottom" value="<%= b%>"/>
<jsp:param name="height" value="<%= h%>"/>
</jsp:include>
</FONT>
</BODY>
</HTML>
lader.jsp
<%@ page contentType="text/html;charset=GB2312"%>
<%!double a1,b1,h1,area;%>
<%
String top1=request.getParameter("top");
String bottom1=request.getParameter("bottom");
String height1=request.getParameter("height");
try{
a1=Double.parseDouble(top1);
b1=Double.parseDouble(bottom1);
h1=Double.parseDouble(height1);
}catch(Exception e){}
area=(a1+b1)/2*h1;
%>
上底下底和高分别为<%=a1 %>、<%=b1 %>、<%=h1 %>的梯形面积为:<%=area %>