第五周作业

任务一、教材P39实验3

复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body bgcolor=cyan>
    <br>英文课文(English Text):
    </br>
    <p style="font-family: 宋体; font-size: 18; color: black">
        <jsp:include page="english/english.txt" />
        <br>课文音频(English Audio)</br>
        <jsp:include page="audio.jsp" />
    </p>
</body>
</html>
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body bgcolor=pink>
    <embed src="english/english.mp3" autostart=false> 课文音频
    </embed>
</body>
</html>
复制代码

2.任务二、教材P45  8题

复制代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 <%!double r=(int)(Math.random()*10)+1; %>
<jsp:include page="circle.jsp">
<jsp:param name="r" value="7"/>
</jsp:include>
<br>
<jsp:include page="ladder.jsp">
<jsp:param name="s" value="5"/>
<jsp:param name="x" value="7"/>
<jsp:param name="g" value="6"/>
</jsp:include>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'index1.jsp' starting page</title>
  </head>
  <body>
 
   
   
  </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%>">
    <title>My JSP 'index1.jsp' starting page</title>
  </head>
  <body>
    <%!double getarea(double r){
           double area=3.14*r*r;
           return area;
   } %>
   <%
   String r=request.getParameter("r");
   double r1=Double.parseDouble(r);
   double area=getarea(r1);
   out.print("圆形的半径是"+r+",圆形的面积:"+area);
    %>
  </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%>">
    <title>My JSP 'index1.jsp' starting page</title>
  </head>
  <body>
     <%!double getarea(double s,double x,double g){
           double area=(s+x)*g/2;
           return area;
   } %>
   <%
   String string=request.getParameter("s");
   double s1=Double.parseDouble(string);
   string=request.getParameter("x");
   double x1=Double.parseDouble(string);
   string=request.getParameter("g");
   double g1=Double.parseDouble(string);
   double area=getarea(s1, x1, g1);
   
   out.print("梯形的上底是"+s1+"下底是"+x1+"高是"+g1+"面积是"+area);
    %>
   
  </body>
</html>
复制代码

 

3.任务三、详见Word图片

复制代码
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
  <head>
    <title>M</title>
    <style type="text/css">
    .box{
    width: 460px;
    height: 90px;
    display:flex;
    justify-content:center;
    align-items:center;
    }
    .top{
    width: 460px;
    height: 30px;
    line-height: 30px;
    background: green;
    text-align: center;
    }
    .left{
    width: 230px;
    height: 30px;
    line-height: 30px;
    background: red;
    text-align: center;
    float:left;
    }
    .main{
    width: 230px;
    height: 30px;
    line-height: 30px;
    background: blue;
    text-align: center;
    float:right;
    }
    .end{
    width: 460px;
    height: 30px;
    line-height: 30px;
    background: yellow;
    text-align: center;
    }
    </style>
  </head>
  
  <body>
  <div class="box">
    <div class="top">
    <jsp:include page="3.top.jsp"></jsp:include>
    </div>
    <div class="left">
    <jsp:include page="3.left.jsp"></jsp:include>
    </div>
    <div class="main">
    <jsp:include page="3.main.jsp"></jsp:include>
    </div>
    <div class="end">
    <jsp:include page="3.end.jsp"></jsp:include>
    </div>
    </div>
  </body>
</html>
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
top.jsp文件
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
left.jsp文件
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
main.jsp文件
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
end.jsp文件
复制代码

4.任务四、详见Word

复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
    <%
        int i = Math.round((int) (Math.random() * 10));
        if (i % 2 == 0) {
    %>
    <jsp:forward page="even.jsp"></jsp:forward>
    <%
        } else {
    %>
    <jsp:forward page="odd.jsp"></jsp:forward>
    <%
        }
    %>
</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%>">
<title>My JSP 'one.jsp' starting page</title>
</head>
<body>
    <%
        String m = request.getParameter("num");
        int n = Integer.parseInt(m);
        out.print("随机数为" + n + "<br>");
    %>
    Hello,我是一个奇数!
</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%>">
<title>My JSP 'two.jsp' starting page</title>
</head>

<body>
    <%
        String m = request.getParameter("num");
        int n = Integer.parseInt(m);
        out.print("随机数为" + n + "<br>");
    %>
    Hello,我是一个偶数!
</body>
</html>
复制代码

 

 
posted @ 2022-04-03 14:21  刘姝彤  阅读(5)  评论(0编辑  收藏  举报