Fork me on GitHub

JSP第五周作业

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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body bgcolor=cyan>
<br>英文课文(English Text):</br>
<p style="font-famliy:宋体;font-size:18;color:black">
<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 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></title>
</head>
<body bgcolor=pink>
<embed src="English/english.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>
<% int r = 2,s = 2,x = 3,h = 2; %>
<jsp:include page="circle.jsp">
<jsp:param value="<%= r %>" name="radius"/>
</jsp:include>
<jsp:include page="ladder.jsp">
<jsp:param value="<%= s %>" name="up"/>
<jsp:param value="<%= x %>" name="low"/>
<jsp:param value="<%= h %>" name="height"/>
</jsp:include>
</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>
<%!
public double getArea(int r){
	return r*3.14;
}
%>
<%
int r = Integer.parseInt(request.getParameter("radius"));
%>
<br>
<b>圆的半径为:<%= r %></b>
<br>
<b>
面积为:<%= getArea(r) %>
</b>
</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>
<%!
public double getArea(int u,int l,int h){
	return (u+l)*h/2;
}
%>
<%
int u = Integer.parseInt(request.getParameter("up"));
int l = Integer.parseInt(request.getParameter("low"));
int h = Integer.parseInt(request.getParameter("height"));
%>
<br>
<b>梯形的上底为:<%= u %>,下底为:<%= l %>,高为:<%= h %></b>
<br>
<b>
面积为:<%= getArea(u,l,h) %>
</b>
</body>
</html>

3.任务三、详见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>
<style type="text/css">
td{
			/* margin: auto; */
		width: 200px;
		text-align:center;
		background: yellow;
		}
		tr{
			width:400px;
			height:50px;
		}
		td,tr,table{
			border: 1px solid red;
		}
</style>
</head>
<body>
<table>
<tr>
<td id="top" colspan="2"><jsp:include page="top.jsp"></jsp:include></td>

</tr>
<tr>
<td id="left"><jsp:include page="left.jsp"></jsp:include></td>
<td id="main"><jsp:include page="main.jsp"></jsp:include></td>

</tr>
<tr>
<td id="end" colspan="2"><jsp:include page="end.jsp"></jsp:include></td>
</tr>
</table>
</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" 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>
<h1>Hello,我是一个偶数!</h1>
</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>
<h1>Hello,我是一个奇数!</h1>
</body>
</html>

 

posted @ 2022-03-30 21:30  Y6  阅读(31)  评论(0编辑  收藏  举报