jsp第五周作业

1.任务一、教材P39实验3

复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body bgcolor=pink>
<p style="font-family:宋体;font-size:18">
<br>英文课文(English Text)</br>
<jsp:include page="english/english.txt"></jsp:include>

<br>课文音频(English Audio)</br>
<jsp:include page="audio.jsp"></jsp:include>
</body>
</html>
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
<embed src="english/english.mp3" autostart="false">
课文音频
</body>
</html>
复制代码

 

 

 

2.任务二、教材P45  8题

复制代码
<%@ page language="java" contentType="text/html; charset=utf-8" 
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
<jsp:include page="a.jsp">
<jsp:param value="5" name="r"/>
<jsp:param value="5" name="x"/>
<jsp:param value="5" name="s"/>
<jsp:param value="2" name="g"/>
</jsp:include>


</body>
</html>
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
被加载的圆面积
<%
    String r= request.getParameter("r");
    out.println(Double.parseDouble(r)*Double.parseDouble(r)*3.14);
%>
被加载的梯形面积
<%
    String s= request.getParameter("r");
    String x= request.getParameter("r");
    String g= request.getParameter("r");
    out.println((Double.parseDouble(s)+Double.parseDouble(x))*Double.parseDouble(g)/2);
%>
</body>
</html>
复制代码

 

 

 

 

 

3.任务三、详见Word图片

复制代码
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</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" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%= "left" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%= "top" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%= "right" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%= "bottom" %>

 

 

4.任务四、详见Word图片

复制代码
<%@page import="java.util.Random"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
    int a = new Random().nextInt(11);
if(a/2==0){%>
    <jsp:forward page="number1.jsp"></jsp:forward>
<%}else{%>
    <jsp:forward page="number2.jsp"></jsp:forward>
<%}
%>
</body>
</html>
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
偶数
</body>
</html>
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
奇数
</body>
</html>
复制代码

posted @ 2022-06-29 11:26  pipiya666  阅读(24)  评论(0编辑  收藏  举报