1、教材p39实验3(听英语)
<%@ 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 'audio.jsp' starting page</title> </head> <body bgcolor=pink> <embed src="任务一素材/english.mp3"autostart=false> 课文音频 </embed> </body> </html>
<%@ page contentType="textml"%> <%@ page 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 '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/english.txt"/> <br>课文音频(English Audio):<br/> <jsp:include page="audio.jsp"/> </p> </body> <ml>

2、教材p45第8题
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'main.jsp' starting page</title>
</head>
<body bgcolor=Thistle>
<jsp:include page="circle.jsp">
<jsp:param value="5" name="r"/>
</jsp:include>
<p>--------分割线--------</p>
<jsp:include page="ladder.jsp">
<jsp:param value="5" name="sd"/>
<jsp:param value="8" name="xd"/>
<jsp:param value="8" name="h"/>
</jsp:include>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'circle.jsp' starting page</title>
</head>
<body>
我是被加载的求圆形面积界面
<%
String r=request.getParameter("r");
double b=Double.parseDouble(r);
double area=3.14*b*b;
out.print(area);
%>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'ladder.jsp' starting page</title>
</head>
<body>
我是被加载的求梯形面积界面
<%
String sd=request.getParameter("sd");
String xd=request.getParameter("xd");
String h=request.getParameter("h");
double s=Double.parseDouble(sd);
double x=Double.parseDouble(xd);
double H=Double.parseDouble(h);
double area=(s+x)*H/2;
out.print(area);
%>
</body>
</html>


<%@ 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文件


<%@ 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 'first.jsp' starting page</title> </head> <body> <% String r=request.getParameter("i"); int x=Integer.parseInt(r); out.print("随机数"+x); %><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 'first.jsp' starting page</title> </head> <body> <% String r=request.getParameter("i"); int x=Integer.parseInt(r); out.print("随机数"+x); %><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 'first.jsp' starting page</title> </head> <body> <% int i = (int) (Math.random() * 10 + 1); if (i % 2 == 0) { %> <jsp:forward page="second.jsp"> <jsp:param value="<%=i %>" name="i" /> </jsp:forward> <% } else { %> <jsp:forward page="first.jsp"> <jsp:param value="<%=i %>" name="i" /> </jsp:forward> <% } %> </body> </html>

posted on
浙公网安备 33010602011771号