1.任务一、教材P39实验3
1 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 4 <html> 5 <head> 6 <title>text1</title> 7 </head> 8 9 <body> 10 <h2>英文课文(English Text):</h2> 11 <p style="font-family: 宋体;font-size: 18;color: black;"> 12 <jsp:include page="english/english.txt"/> 13 <br>课文音频(English Audio):<br> 14 <jsp:include page="audio.jsp"/> 15 </p> 16 </body> 17 </html>
1 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 4 <html> 5 6 7 <body> 8 <embed src="english/english.mp3" autoplay="false"> 9 </body> 10 </html>
2.任务二、教材P45 8题
1 <body> 2 <h2>半径为2的圆的面积:</h2> 3 <p> 4 <jsp:include page="circle.jsp"> 5 <jsp:param value="2" name="r"/> 6 </jsp:include> 7 </p><br><br> 8 <h2>上底2,下底4,高2的梯形的面积:</h2> 9 <p> 10 <jsp:include page="ladder.jsp"> 11 <jsp:param value="2" name="s"/> 12 <jsp:param value="4" name="x"/> 13 <jsp:param value="2" name="g"/> 14 </jsp:include> 15 </p> 16 </body>
1 <body> 2 <% 3 String r=request.getParameter("r"); 4 double a=Double.parseDouble(r); 5 double s=3.14*a*a; 6 %> 7 <h3><%=s %></h3> 8 </body> 9 10 11 <body> 12 <% 13 String s=request.getParameter("s"); 14 String x=request.getParameter("x"); 15 String g=request.getParameter("g"); 16 double a=Double.parseDouble(s); 17 double b=Double.parseDouble(x); 18 double c=Double.parseDouble(g); 19 double m=(a+b)*c*0.5; 20 %> 21 <h3><%=m %></h3> 22 </body>
3.
任务三、详见Word图片
<body> <table border="1" align="center"> <tr align="center"><td colspan="2"><%@ include file="top.jsp" %></td></tr> <tr align="center"><td><%@ include file="left.jsp" %></td><td><%@ include file="main.jsp" %></td></tr> <tr align="center"><td colspan="2"><%@ include file="end.jsp" %></td></tr> </table> </body>
<h4>top.jsp的文件内容包含在这里</h4> <h4>left.jsp的文件内容包含在这里</h4> <h4>main.jsp的文件内容包含在这里</h4> <h4>end.jsp的文件内容包含在这里</h4>
4.
任务四、详见Word图片
<%@ page language="java" import="java.util.Random" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <body> <% int i=(int)(Math.random()*10)+1; if(i/2==0){ %> <jsp:forward page="end.jsp"/> <% }else{ %> <jsp:forward page="left.jsp"/> <%} %> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <body> <h1>Hello,我是一个偶数!</h1> </body> </html> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <body> <h1>Hello,我是一个奇数!</h1> </body> </html>