第五周

1.

<body bgcolor=green>
    <br>englishi text:</br>
    <p style="font-family:宋体;font-size:18;color:blake;">
    <jsp:include page="english/english.txt"/>
    <br>音频:<br/>
    <jsp:include page="radio.jsp"/>
    </p>
  </body>


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

2.

<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>
<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>


 <body>
<%
    double r=3,a=2,b=5,c=2;
 %>
 <br>加载circle.jsp计算半径为<%=r %>的圆的面积:
     <jsp:include page="circle.jsp">
         <jsp:param value="<%=r %>" name="sideR"/>
     </jsp:include>
 <br>加载ladder.jsp计算上底、下底、高为<%=a %>,<%=b %><%=c %>的梯形面积
     <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>   

3.

<head>
    <style type="text/css">
    .box{
    width: 460px;
    height: 90px;
    display:flex;
    justify-content:center;
    align-items:center;
    }
    .top{
    width: 600px;
    height: 40px;
    line-height: 40px;
    background: yellow;
    text-align: center;
    }
    .left{
    width: 300px;
    height: 40px;
    line-height:40px;
    text-align: center;
    float:left;
    }
    .right{
    width: 300px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    float:right;
    }
    .end{
    width: 600px;
    height: 40px;
    line-height: 40px;
    background: yellow;
    text-align: center;
    }
    </style>
  </head>
<body>
    <div class="box">
    <div class="top">
    <jsp:include page="top.jsp"></jsp:include>
    </div>
    <div class="left">
    <jsp:include page="left.jsp"></jsp:include>
    </div>
    <div class="right">
    <jsp:include page="right.jsp"></jsp:include>
    </div>
    <div class="end">
    <jsp:include page="end.jsp"></jsp:include>
    </div>
    </div>
  </body>

<body>
    This is my top <br>
  </body>

 

4.

<body>
    <%
        int i = (int) (Math.random() * 10 + 1);
        if (i % 2 == 0) {
    %>
    <jsp:forward page="odd.jsp">
        <jsp:param value="<%=i %>" name="i" />
    </jsp:forward>
    <%
        } else {
    %>
    <jsp:forward page="even.jsp">
        <jsp:param value="<%=i %>" name="i" />
    </jsp:forward>
    <%
        }
    %>
</body>

<body>
  <%
  String r=request.getParameter("i");
  int x=Integer.parseInt(r);
  out.print("随机数"+x); %>
  Hello,我是奇数!!!
    
  </body>

<body>
    <%
  String r=request.getParameter("i");
  int x=Integer.parseInt(r);
  out.print("随机数"+x); %>
    Hello,我是偶数!!!
  </body>

 

posted @ 2022-04-03 14:38  jth12  阅读(9)  评论(0编辑  收藏  举报