第三次作业

1. 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="META-INF/english.txt"/>
<br>课文音频(English Audio);</br>
<jsp:include page="audio.jsp"/>
</p>
</body>
</html>

  

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="ISO-8859-1"%>
<!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="META-INF/engkish.mp3"autostart=false>
课文音频
</embed>

</body>
</html>

  

 

 

  2. P45 8

<%@ 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>
       <%  double r=5;
           double h=2;
           double a=4;
           double b=6;
       %>
       <p style =font-family:宋体;font-size;36;>
       <jsp:include page="circle.jsp">
        <jsp:param value="<%=r%>" name="r"/>
         </jsp:include>
       <jsp:include page="ladder.jsp">
       <jsp:param value="<%=h%>" name="h"/>
       <jsp:param value="<%=a%>" name="a"/>
       <jsp:param value="<%=b%>" name="b"/>
       </jsp:include>
      
       </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>
     <%
          String sideh=request.getParameter("h");
           String sidea=request.getParameter("a");
            String sideb=request.getParameter("b");
            double s1;
            double h1=Double.valueOf(sideh);
            double a1=Double.valueOf(sidea);
            double b1=Double.valueOf(sideb);
            s1=(a1+b1)*h1/2.0;
            %>
            梯形的面积:<%=s1 %>
          
</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>
<%
String r=request.getParameter("r");
double s;
double c=Double.valueOf(r);
s=c*c*3.14;

%>
圆的面积:<%=s %>
</body>
</html>

 

 

第三题

 

 

 

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

<html>
<head>
<title>My JSP 'end.jsp' starting page</title>
<style type="text/css">
div{
    border:1px solid red;
    display: inline;
}
#d1{
    width: 400px;
}
#d2{
    width: 200px;
}
#d3{
    width: 200px;
}
#d4{
    width: 400px;
}
</style>
</head>
<body>
    <hr align="center" color="red">
    <div id="d1" align="center">
    <jsp:include page="top.jsp"></jsp:include>
    </div>
    <br>
    <div id="d2" align="center">
    <jsp:include page="left.jsp"></jsp:include>
    </div>
    <div id="d3" align="center">
    <jsp:include page="main.jsp"></jsp:include>
    </div>
    <br>
    <div id="d4" align="center">
    <jsp:include page="end.jsp"></jsp:include>
    </div>
</body>
</html>

 

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

<html>
  <head>
    <title>My JSP 'end.jsp' starting page</title>
  </head>
  <body>
    This is end.jsp. <br>
  </body>
</html>

  

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

<html>
  <head>
    <title>My JSP 'end.jsp' starting page</title>
  </head>
  <body>
    This is left.jsp. <br>
  </body>
</html>

  

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

<html>
  <head>
    <title>My JSP 'end.jsp' starting page</title>
  </head>
  <body>
    This is main.jsp. <br>
  </body>
</html>

  

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

<html>
  <head>
    <title>My JSP 'end.jsp' starting page</title>
  </head>
  <body>
    This is top.jsp. <br>
  </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 'odd.jsp' starting page</title>

<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>
    <%
        String odd = request.getParameter("i");
        int j = Integer.parseInt(odd);
        out.print("随机数" + j);
    %>
    是奇数!!!
</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 'even.jsp' starting page</title>

<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>
    <%
        String even = request.getParameter("i");
        int ou = Integer.parseInt(even);
        out.print("随机数" + ou);
    %>
    是偶数!!!

</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 'example2.jsp' starting page</title>

<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>
    <h1>生成[]0,10]之间的随机数</h1>
    <%
        int i = (int) (Math.random() * 10) + 1;
        if (i % 2 == 0) {
    %>
    <jsp:forward page="even.jsp">
        <jsp:param value="<%=i %>" name="i" />
    </jsp:forward>
    <%
        } else {
    %>
    <jsp:forward page="odd.jsp">
        <jsp:param value="<%=i%>" name="i" />
    </jsp:forward>
    <%
        }
    %>
</body>
</html>

 

 

posted @ 2022-04-03 19:34  monster丶易  阅读(4)  评论(0编辑  收藏  举报