第五周JSP作业

1.任务一、教材P39实验3

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <body bgcolor="cyan">
  <br>英文课文(English Text):</br>
  <p style="font-family: 宋体;font-size: 18;color: black">
  <jsp:include page="english.txt"/>
  <br>课文音频(English Audio):</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>
  <body bgcolor=pink>
  <embed src="english/english.mp3"autostart="flase">
  课文音频
  </embed>
  

  </body>
</html>

2.任务二、教材P45  8题

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
  </head>
  
  <body>
   加载circle.jsp页面计算圆的面积:
   <jsp:include page="circle.jsp">
   <jsp:param value="5" name="r"/>
   </jsp:include>
  <br> 加载ladder.jsp页面计算梯形面积:
   <jsp:include page="ladder.jsp">
   <jsp:param value="5" name="a"/>
   <jsp:param value="4" name="b"/>
   <jsp:param value="2" 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>
  </head>
  
  <body>
    <b>被加载的文件,计算圆的面积</b>
    <%
    String r=request.getParameter("r");
    double r1=Double.parseDouble(r);
    double area=3.14*r1*r1;
    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>
  </head>
  
  <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 area=((a1+b1)*h1)/2.0;
  out.print("梯形面积是:"+area);
   %>
  </body>
</html>

3.任务三、详见Word图片

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
  </head>
  
  <body>
  <table width='400px' height='500px' border="1"bordercolor="green"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="end.jsp" %></td>
  </tr>
  </table>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
NN
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
NN
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
OO
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
66

4.任务四、详见Word图片

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <body>
    <%
    double i=(int)(Math.random()*10)+1;
    if(i%2==0){
    %>
    <jsp:forward page="oushu.jsp">
    <jsp:param value="<%=i %>" name="number"/>
    </jsp:forward>
   <%  }
    
     else{
     
     %>
      <jsp:forward page="jishu.jsp">
    <jsp:param value="<%=i %>" name="number"/>
    </jsp:forward>
     <% }
      %>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

  <body>
   <%
   String s=request.getParameter("number");
   out.print("Hello,我是奇数"+s);
    %>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

  <body>
   <%
   String s=request.getParameter("number");
   out.print("Hello,我是偶数"+s);
    %>
  </body>
</html>

 

posted @ 2022-04-03 13:30  宋驰  阅读(43)  评论(0编辑  收藏  举报