第五周

1.

index

<%@ 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>My JSP 'index.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>


<body bgcolor = cyan>
<br>英文课文(english)</br>
<p style = "font-famliy:宋体;font - size:18;color:black">
<jsp:include page = "english/english.txt"/>
<br>课文音频(English Audio):</br>
<jsp:include page = "audio.jsp"/>
</p>
</body>
</html>

audio.jsp

<%@ 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>My JSP 'audio.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

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

 

 

2.

<%@ 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>My JSP 'index.jsp' starting page</title>
  </head>
  
  <body>
  园半径为5<br>
    <jsp:include page="circle.jsp">
    <jsp:param value="5" name="r"/>
    </jsp:include><br>
    梯形上底为3,下底为5,高为4<br>
    <jsp:include page="ladder.jsp">
    <jsp:param value="3" name="s"/>
    <jsp:param value="5" name="x"/>
    <jsp:param value="4" name="h"/>
    </jsp:include>
  </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>My JSP 'circle.jsp' starting page</title>
    
  </head>
  
  <body>
    圆形面积:
    <%
      String r= request.getParameter("r");
      double bj=Double.parseDouble(r);
      double area=3.14*bj*bj;
      out.print(area); 
     %>
     
  </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>My JSP 'ladder.jsp' starting page</title>
    
  </head>
  
  <body>
    梯形面积:
    <%
      String s= request.getParameter("s");
      String x= request.getParameter("x");
      String h= request.getParameter("h");
      double sb=Double.parseDouble(s);
      double xb=Double.parseDouble(x);
      double g=Double.parseDouble(h);
      double area=(sb+xb)*g/2;
      out.print(area); 
     %>
     
  </body>
</html>

 

 3.

<%@ 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>
复制代码
<%@ 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>

 

 4.

<%@page import="java.util.Random"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
    int a = new Random().nextInt(11);
if(a/2==0){%>
    <jsp:forward page="number1.jsp"></jsp:forward>
<%}else{%>
    <jsp:forward page="number2.jsp"></jsp:forward>
<%}
%>
</body>
</html>
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
偶数
</body>
</html>
复制代码
复制代码
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
奇数
</body>
</html>

 

 

 

 

posted @ 2022-04-01 23:14  刘德璞  阅读(30)  评论(0编辑  收藏  举报