作业

1.

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body bgcolor=cyan>
    <br>英文课文(English Text):
    </br>
    <p style="font-family:宋体; font-size:18;color:black">
        <jsp:include page="1" />
        <br>课文音频(English Audio):</br>
        <jsp:include page="MyJsp.jsp" />
    </p>
</body>
</html>

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body bgcolor=pink>
    <embed src="english/english.mp3" autostart=false>
    课文音频
    </embed>
</body>
</html>

 

 

 2.

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
     
     
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
 
  </head>
   
  <body>
     <%
  double r = 5, a = 4, b = 7, c =2;
 %>
  <br>加载jsp计算半径为<%=r %>的圆的面积:
     <jsp:include page="MyJsp.jsp">
         <jsp:param value="<%=r %>" name="sideR"/>
     </jsp:include>
     <p>---------------------------------------------------------------------</p >
 <br>加载jsp计算上底、下底、高为<%=a %>,<%=b %><%=c %>的梯形面积
     <jsp:include page="two.jsp">
         <jsp:param value="<%=a %>" name="sideA"/>
         <jsp:param value="<%=b %>" name="sideB"/>
         <jsp:param value="<%=c %>" name="sideC"/>
     </jsp:include>
  </body>
</html>

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
     
     
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
 
  </head>
   
  <body>
     <%!public String getArea(double r) {
  if (r > 0) {
   double area = r * r * 3.14;
   return "" + area;
  } else {
   return ("半径为" + r + "不能为大于0以外的数字,无法计算面积");
  }
 }%>
 
 <%
  String sideR = request.getParameter("sideR");
  double r = Double.parseDouble(sideR);
 %>
 
 <br>
 <br>我是被加载的文件,负责计算圆的面积
 <br> 给我传递的半径是:<%=r%>
 <br>圆的面积是:<%=getArea(r)%>
  </body>
</html>

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
     
     
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
 
  </head>
   
  <body>
     <%!public String getArea(double a, double b, double c) {
  if (a > 0 && b > 0 && c > 0) {
   double area = (a + b) * c / 2;
   return "" + area;
  } else {
   return ("梯形的上底、下底、高" + a + " " + b + " " + c + "不能为大于0以外的数字,无法计算面积");
  }
 }%>
  
 <%
  String sideA = request.getParameter("sideA");
  String sideB = request.getParameter("sideB");
  String sideC = request.getParameter("sideC");
  double a = Double.parseDouble(sideA);
  double b = Double.parseDouble(sideB);
  double c = Double.parseDouble(sideC);
 %>
 <br>
 <br>我是被加载的文件,负责计算圆的面积
 <br> 给我传递的上底、下底、高是:<%=sideA%>
 <%=sideB%>
 <%=sideC%>
 <br>梯形的面积是:<%=getArea(a, b, c)%>
  </body>
</html>

 

 

posted @ 2022-04-03 18:31  柳啊柳啊柳  阅读(8)  评论(0编辑  收藏  举报