第五周作业

任务一教材P39实验3

 

 

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
 <embed src="english.mp3">
 课文音频
 
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
 <br>英文课文(english text) :</br>
 <jsp:include page="english.txt"></jsp:include>
 <br>课文音频(english audio) :</br>
 <jsp:include page="audio.jsp"></jsp:include>
 
 
  </body>
</html>

 

 

 

任务二、教材P45  8

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
 <br>圆形的面积 为</br>
 <jsp:include page="circle.jsp">
 <jsp:param value="3" name="r"/></jsp:include>

  
 <br>梯形的面积为 </br>
 <jsp:include page="ladder.jsp">
 <jsp:param value="2" name="t"/>
 <jsp:param value="3" name="b"/>
 <jsp:param value="4" name="h"/></jsp:include>
  </body>
</html>

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
  <%
 String r=request.getParameter("r");
 double rr=Double.parseDouble(r);
 double area=3.14*rr*rr;
 out.print(area);
 
 
  %>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
 <%
 String t=request.getParameter("t");
 double tt=Double.parseDouble(t);
 
 String b=request.getParameter("b");
 double bb=Double.parseDouble(b);
 
 String h=request.getParameter("h");
 double hh=Double.parseDouble(h);
 
 double area=(tt+bb)*hh/2;
 out.print(area);
  %>
  </body>
</html>

 

 

 

提示:圆形面积需要一个param  梯形面积需要3param,可以参考教材例2-11

任务三、

 

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
  
    <table border="1" bordercolor="green"> 
        
            
        <tr>  
            <th colspan="2"><%@ include file="top.jsp" %></th>    
        </tr>
        <tr>  
            <th ><%@ include file="left.jsp" %></th>    
        
            <th ><%@ include file="right.jsp" %></th>    
        </tr>
        <tr>  
            <th colspan="2"><%@ include file="bottom.jsp" %></th>    
        </tr>
        
    </table>
  
  
 
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%= "top" %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%= "left" %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%= "right" %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%= "bottom" %>

 

 

任务四、

 

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
 
  <%
        int i = (int) (Math.random() * 10 + 1);
        if (i % 2 == 0) {
    %>
    <jsp:forward page="number2.jsp">
     <jsp:param value="<%=i %>" name="num" />
    </jsp:forward>
    <%
        } else {
    %>
    <jsp:forward page="number1.jsp">
        <jsp:param value="<%=i %>" name="num" />
    </jsp:forward>
    <%
        }
    %>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
 <%
 String r=request.getParameter("num");
 int n=Integer.parseInt(r);
 out.print(n);
 
  %>
 是奇数
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    
  </head>
  
  <body>
 <%
 String r=request.getParameter("num");
 int n=Integer.parseInt(r);
 out.print(n);
 
  %>
 是偶数
  </body>
</html>

 

posted @ 2022-03-30 16:14  崔明月  阅读(27)  评论(0编辑  收藏  举报