贾云鹏

jsp第五周作业

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

<%@ 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>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Insert title here</title>
  </head>
  
 <body bgcolor=cyan>
    <br>英文课文(English Text):
    </br>
    <p style="font-family: 宋体; font-size: 18; color: black">
        <jsp:include page="english/english.txt" />
        <br>课文音频(English Audio)</br>
        <jsp:include page="audio.jsp" />
    </p>
  </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>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Insert title here</title>
  </head>
   <body bgcolor=pink>
    <embed src="english/english.mp3" autostart=false> 课文音频
    </embed>
  </body>
</html>

2.任务二、教材P45  8题

<%@ 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>
      <body bgcolor=cyan>
      加载circle.jsp计算圆的面积:
      <jsp:include page="circle.jsp">
      <jsp:param name="r" value="2" />
      </jsp:include>
      <p></p>
      加载ladder.jsp计算梯形面积:
      <jsp:include page="ladder.jsp">
      <jsp:param name="t" value="3" />
      <jsp:param name="e" value="4" />
      <jsp:param name="h" value="5" />
      </jsp:include>
  </head>
  
  <body>
   
  </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>
    <base href="<%=basePath%>">
    
    <title>圆的面积</title>
    
  
  <body>
      <% String r=request.getParameter("r");
         double r1=Double.parseDouble(r);
         double area1=3.14*r1*r1;
         out.print("圆的面积是:"+area1);
   %>
  </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>
    <base href="<%=basePath%>">
    
    <title>梯形的面积</title>

  </head>
  
  <body>
    <% String t=request.getParameter("t");
         String e=request.getParameter("e");
         String h=request.getParameter("h");
         double t1=Double.parseDouble(t);
         double e1=Double.parseDouble(e);
         double h1=Double.parseDouble(h);
         double area2=((t1+e1)*h1/2);
         out.print("梯形的面积是:"+area2);
      %>
  </body>
</html>

3.任务三、详见Word图片

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

<html>
<head>


</head>

<body>

    <table border="1"  align="center" bgcolor=pink >
        <tr align="center"><td colspan="2" ><%@ include file="top.jsp"%></td>
        </tr>
        <tr align="center">
            <td  ><%@include file="left.jsp" %></td>
            <td  ><%@ include file="right.jsp" %></td>
        </tr>
        <tr align="center"><td colspan="2"  ><%@ include file="bottom.jsp" %></td></tr>
    </table>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

  <h2>这是bottom.jsp页面</h2>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<h2>这是left.jsp页面</h2>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

    <h2>这是right.jsp页面</h2>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>



    <h2>这是top.jsp页面</h2>

4.任务四、详见Word图片

<%@ 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>
         <% int a=(int)(Math.random()*10)+1;
           if(a%2==0){
             %>
    <jsp:forward page="even.jsp"/>
          <%} else{%>   
    <jsp:forward page="uneven.jsp"/>
        <%} %>
  </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 a=request.getParameter("even");
   out.print("这是一个偶数"); %>
  </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 a=request.getParameter("odd");
   out.print("这是一个奇数"); %>
  </body>
</html>

 

posted on 2022-04-02 14:48  贾云鹏  阅读(13)  评论(0编辑  收藏  举报

导航