Glame

JSP第五周作业

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
 %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>My JSP 'index.jsp' starting page</title>
</head>

<body bgcolor=cyan>
    <br>英文课文(English Text):
    </br>
    <p style="font-family: 宋体;font-size: 18;color: black">
        <jsp:include page="english.txt" />
        <br>课文音频(English Audio):</br>
        <jsp:include page="audio.jsp" />
    </p>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>My JSP 'index.jsp' starting page</title>
</head>

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

 

 

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>My JSP 'index.jsp' starting page</title>
</head>

  <body>
    <jsp:include page="circle.jsp">
    <jsp:param value="5" name="r"/>
    </jsp:include>
    <jsp:include page="ladder.jsp">
    <jsp:param value="4" name="h"/>
    <jsp:param value="6" name="sd"/>
    <jsp:param value="3" name="xd"/>
    </jsp:include>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>My JSP 'index.jsp' starting page</title>
</head>

<body>
    <%
        double r = request.getParameter("r") == null ? 0 : Double
                .parseDouble(request.getParameter("r"));
        double area = 3.14 * r * r;
        out.print("圆的半径为:" + r + "</br>面积为:" + area);
        out.print("</br>--------------------------------</br>");
    %>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>My JSP 'index.jsp' starting page</title>
</head>

<body>
    <%
        double h = request.getParameter("h") == null ? 0 : Double
                .parseDouble(request.getParameter("h"));
        double sd = request.getParameter("sd") == null ? 0 : Double
                .parseDouble(request.getParameter("sd"));
        double xd = request.getParameter("xd") == null ? 0 : Double
                .parseDouble(request.getParameter("xd"));
        double area = ((sd + xd) * h) / 2;
        out.print("梯形上底:" + sd + "</br>下底:" + xd + "</br>高:" + h
                + "</br>面积:" + area);
    %>
</body>
</html>

 

 

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
<meta charset="utf-8">
</head>

<body>
    <table border="1" align="center" bgcolor="yellow">
        <tr align="center">
            <td colspan="2"><jsp:include page="top.jsp"></jsp:include>
        <tr align="center">
            <td><jsp:include page="left.jsp"></jsp:include></td>
            <td><jsp:include page="right.jsp"></jsp:include></td>
        <tr align="center">
            <td colspan="2"><jsp:include page="end.jsp"></jsp:include>
    </table>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
 <%="top.jsp的文件内容包含在这里" %>
 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
 <%="left.jsp的文件内容包含在这里" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%="end.jsp的文件内容包含在这里" %>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
    <%
        int i = (int) (Math.random() * 10 + 1);
        if (i % 2 == 0) {
    %>
    <jsp:forward page="ou.jsp">
        <jsp:param value="<%=i %>" name="num" />
    </jsp:forward>
    <%
        } else {
    %>
    <jsp:forward page="ji.jsp">
        <jsp:param value="<%=i %>" name="num" />
    </jsp:forward>
    <%
        }
    %>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>My JSP 'index.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"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
    <%
        String m = request.getParameter("num");
        int n = Integer.parseInt(m);
        out.print("随机数为" + n + "<br>");
    %>
    Hello,我是一个偶数!
</body>
</html>

 

posted on 2022-04-03 14:06  Glame  阅读(6)  评论(0编辑  收藏  举报

导航