第三次作业

任务一教材P39实验3

 

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
  </head>
  
  <body bgcolor=cyan>
  	<br>英语课文(English Text):</br>
    <p style="font-family: 宋体; font-size: 18; color: black">
    <jsp:include page="english/english.txt"></jsp:include>
    <br> 课文音频(English Audio):</br>
    <jsp:include page="audio.jsp"></jsp:include>
    </p>
  </body>
</html>

 

  

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
 
  </head>
  
  <body bgcolor="pink">
    <embed src="english/english.mp3" autoplay="false">
    课文音频
    </embed>
    
  </body>
</html>

 

 

 

任务二、教材P45  8

提示:圆形面积需要一个param  梯形面积需要3param,可以参考教材例2-11

 

 

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
  </head>
  
  <body bgcolor=cyan>
  
      加载circle.jsp页面计算的圆的面积
     <jsp:include page="circle.jsp">  <!-- 包含circle.jsp -->
     <jsp:param value="5" name="r"/>  <!-- 传r=5的值 -->
     </jsp:include>
     
     加载ladder.jsp页面计算的圆的面积
     <jsp:include page="ladder.jsp">
     <jsp:param value="5" name="a"/>
     
      <jsp:param value="4" name="b"/>
     
      <jsp:param value="6" name="h"/>
     </jsp:include>
  </body>
</html>

 

  

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <body>
   		 <b>被加载的文件,计算圆的面积</b>
   		<%String r=request.getParameter("r");   //得到r的值 string 型
			double r1=Double.parseDouble(r);    //把r转成double类型 
			double area =3.14*r1*r1;   			//定义面积
			out.print("圆的面积是:"+area);		//输出
   		 %>
   		 <br>
  </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>
  
  <body>
     <b>被加载的文件,计算梯形的面积</b>
   		<%String a=request.getParameter("a");
   		String b=request.getParameter("b");
   		String h=request.getParameter("h");
			double a1=Double.parseDouble(a);
			double b1=Double.parseDouble(b);
			double h1=Double.parseDouble(h);
			double Tarea =((a1+b1)*h1/2);  	
			out.print("梯形的面积是:"+Tarea);	
   		 %>
  </body>
</html>

  

 

 

任务三、

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <body>
   <table width="400px" height="400px" border="2" bordercolor="red" align="center">
    <tr>
    <td colspan="2"><%@ include file="top.jsp" %></td>
    </tr>
     <tr>
    <td><%@ include file="left.jsp" %></td>
        <td><%@ include file="right.jsp" %></td>
    </tr>
     <tr>
    <td colspan="2"><%@ include file="bottom.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">
<html>
  
  </head>
  
  <body>
   <% double r=(int)(Math.random()*10)+1; 
   		if(r%2==0){
   		
   		%>	
   		<jsp:forward page="t1.jsp">
   		<jsp:param value="<%=r %>" name="num"/>
   		</jsp:forward>	
   		
   		<% }
   		else{%>
   		
   		<jsp:forward page="t2.jsp">
   		<jsp:param value="<%=r %>" name="num"/>
   		</jsp:forward>
   		
   		<% }  %>

  </body>
</html>

  

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


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  
  
  <body>
   <%String r=request.getParameter("num");
   out.print("Hello,我是一个偶数"+r); %>
   
  </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>
    
  </head>
  
  <body> <%String r=request.getParameter("num");
   out.print("Hello,我是一个奇数"+r); %>
  </body>
</html>

  

 

 

 

 

posted @ 2022-03-30 10:29  倪楠  阅读(61)  评论(0编辑  收藏  举报