第三次作业
1.
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title></title> </head> <body bgcolor=cyan> <p> <jsp:include page="english.txt"></jsp:include> <jsp:include page="audio.jsp"></jsp:include> </p> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title></title> </head> <body bgcolor=pink> <embed src="english.mp3" autoplay="false"> 课文音频 </embed> </body> </html>
2.
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'main.jsp' starting page</title> </head> <body> <jsp:include page="circle.jsp"> <jsp:param value="10" name="r"/> </jsp:include> <br> <jsp:include page="ladder.jsp"> <jsp:param value="10" name="shang"/> <jsp:param value="20" name="xia"/> <jsp:param value="2" name="gao"/> </jsp:include> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'main.jsp' starting page</title> </head> <body> 圆面积 <% String r=request.getParameter("r"); double a=Double.parseDouble(r); double s=a*a*3.14; out.println(s); %> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'main.jsp' starting page</title> </head> <body> 梯形面积 <% String shang=request.getParameter("shang"); String xia=request.getParameter("xia"); String gao=request.getParameter("gao"); double a=Double.parseDouble(xia); double b=Double.parseDouble(xia); int c=Integer.parseInt(gao); double s=(a+b)*c/2; out.println(s); %> </body> </html>
3.
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'end.jsp' starting page</title> <style type="text/css"> div{ border:1px solid red; display: inline; } #d1{ width: 400px; } #d2{ width: 200px; } #d3{ width: 200px; } #d4{ width: 400px; } </style> </head> <body> <hr align="center" color="red"> <div id="d1" align="center"> <jsp:include page="top.jsp"></jsp:include> </div> <br> <div id="d2" align="center"> <jsp:include page="left.jsp"></jsp:include> </div> <div id="d3" align="center"> <jsp:include page="main.jsp"></jsp:include> </div> <br> <div id="d4" align="center"> <jsp:include page="end.jsp"></jsp:include> </div> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'end.jsp' starting page</title> </head> <body> This is end.jsp. <br> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'end.jsp' starting page</title> </head> <body> This is left.jsp. <br> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'end.jsp' starting page</title> </head> <body> This is main.jsp. <br> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'end.jsp' starting page</title> </head> <body> This is top.jsp. <br> </body> </html>
4.
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'MyJsp.jsp' starting page</title> </head> <body> <% double i = Math.round(Math.random() * 10); if (i % 2 == 0) { %> <jsp:forward page="01.jsp"> <jsp:param value="" name=""/> </jsp:forward> <% } else { %> <jsp:forward page="02.jsp"> <jsp:param value="" name=""/> </jsp:forward> <% } %> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'MyJsp.jsp' starting page</title> </head> <body> 我是偶数! </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>My JSP 'MyJsp.jsp' starting page</title> </head> <body> 我是奇数! </body> </html>