jsp第三次作业

1.在jsp页面中使用include动态标记加载音频

<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'index.jsp' starting page</title>
  </head>
  
  <body bgcolor=pink>
<br>英文课文:</br>
<p style="font-family:宋体;font-size:18;color:black">
<jsp:include page="english\english.txt"/>
<br>课文音频:</br>
<jsp:include page="audio.jsp"/>
</p>
  </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 'audio.jsp' starting page</title>

  </head>
  
  <body bgcolor=blue>
<embed src="english/english.mp3"autostart=false>
课文音频
</embed>
  </body>
</html>

 

 2.

<%@ 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="6" name="r"/>
</jsp:include>
<jsp:include page="ladder.jsp">
<jsp:param value="5" name="sd"/>
<jsp:param value="10" 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>

 

 3.

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'renwusan.jsp' starting page</title>
</head>

<body>
    <table height="200" width="400" border="2" align="center">
        <tr align="center">
            <td colspan="2"><%@ include file="rsone.jsp"%></td>
        </tr>
        <tr align="center">
            <td><%@ include file="rstwo.jsp"%></td>
            <td><%@ include file="rsthree.jsp"%></td>
        </tr>
        <tr align="center">
            <td colspan="2"><%@ include file="rsfour.jsp"%></td>
        </tr>

    </table>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
rsone里边的内容
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
rstwo里边的内容
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
rsthree里边的内容
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
rsfour里边的内容

4.

 

 

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>任务四</title>
</head>

<body>
    <% int shu=(int)(Math.random()*10)+1;
if(shu%2==0){
%>
    <jsp:forward page="one.jsp"/>
<%} else{%>    
<jsp:forward page="two.jsp"/>
<%} %>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>任务四</title>
</head>

<body>
Hello,我是偶数!
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>任务四</title>
</head>

<body>
Hello,我是奇数!
</body>
</html>

 

posted @ 2022-03-31 22:18  高畅  阅读(27)  评论(0编辑  收藏  举报