第三次jsp作业

任务一教材P39实验3

 

 <body bgcolor="cyan">
   <br>英文课本(English Text): </br>
  <p style="font-family: 宋体;font-size: 18;color: black">
  <jsp:include page="dsds/english.txt"/>
  <br>英文音频(English audion): </br>
    <jsp:include page="mps.jsp"/>
   </p>
  </body>

 

  

<body bgcolor="pink">
      <embed src="dsds/english.mp3"> 
                课文音频
        </embed>
 
  </body>

  

 

 

任务二、教材P45  8

 

 <body>
  <%
     double r=3,a=2,b=5,c=2;
  %>
     <jsp:include page="circle.jsp">
          <jsp:param value="<%=r %>" name="sideR"/>
      </jsp:include>
    <p>-----------------------------</p>
     <jsp:include page="ladder.jsp">
          <jsp:param value="<%=a %>" name="sideA"/>
          <jsp:param value="<%=b %>" name="sideB"/>
          <jsp:param value="<%=c %>" name="sideC"/>
      </jsp:include>
  </body>

  

 <body>
  <%
     String sideR=request.getParameter("sideR");
     double r=Double.parseDouble(sideR);
 %>
    <%!    public String getArea(double r)
     {
         if(r>0)
         {
             double area=r*r*3.14;
             return ""+area;
         }
         else{
             return("半径小于0,不能计算");
         }
     }
 %>
 
            半径是:<%=r%>
 <br>圆的面积是:<%=getArea(r) %>
  </body>

  

<body>
   <%
     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);
 %>
    <%!    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("长宽高输入错误");
         }
     }
 %>
 
上底:<%=sideA%> 下底:<%=sideB %>高是:<%=sideC %>
 <br>梯形的面积是:<%=getArea(a,b,c) %>
  </body>

  

 

 

任务三、

<body>
<table border="1">
    <tr align="center">
        <td colspan="2"><%@include file="top.jsp"%></td>
    </tr>
    <tr align="center">
        <td><%@include file="left.jsp"%></td><td><%@include file="right.jsp"%></td>
    </tr>
    <tr align="center">
        <td colspan="2"><%@include file="bottom.jsp"%></td>
    </tr>
</table>
</body>

  

<body>
<%=
"top.jsp的文件内容包含在这里"
%>
</body>

  

<body>
<%=
"left.jsp的文件内容包含在这里"
%>
</body>

  

<body>
<%=
"right.jsp的文件内容包含在这里"
%>
</body>

  

<body>
<%=
"bottom.jsp的文件内容包含在这里"
%>
</body>

  

 

 

任务四、

 <body>
   <%double i=(int)(Math.random()*10)+1;
     if(i%2==1){
      out.print(i);
    %>
     
    <jsp:include page="jishu.jsp">
    <jsp:param name="number" value="<% =i %>"/>
    </jsp:include>
    <%}
    else{
     out.print(i);
     %>
      
     <jsp:include page="oushu.jsp">
     <jsp:param name="number" value="<% =i %>"/>
    </jsp:include>
    <%}
     %>
  </body>

  

<body>
   <% String s=request.getParameter("number");
   out.print( "是奇数");
    %>
  </body>

  

<body>
   <% String s=request.getParameter("number");
   out.print( "是偶数");
    %>
  </body>

  

 

posted @ 2022-03-31 10:51  陈华涛  阅读(25)  评论(0编辑  收藏  举报