ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

第五次周业

2022-04-03 12:32:37  阅读:238  来源: 互联网

标签:周业 代码 第五次 复制 jsp JSP index1 My


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

复制代码
<%@ page contentType="text/html"%> 
<%@ page  pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <body bgcolor=pink>
<embed src="../english/english.mp3"autostart=false>
课文音频
</embed>
</body>  
</html>
复制代码
复制代码
<%@ page contentType="text/html"%> 
<%@ page  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/english.txt" />
<br>课文音频(English Audio):</br>
<jsp:include page="audio.jsp" />
</p>
</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>
    <base href="<%=basePath%>">
    <title>My JSP 'index1.jsp' starting page</title>
  </head>
  <body>
    <%!double getarea(double r){
           double area=3.14*r*r;
           return area;
   } %>
   <%
   String r=request.getParameter("r");
   double r1=Double.parseDouble(r);
   double area=getarea(r1);
   out.print("圆形的半径是"+r+",圆形的面积:"+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 'index1.jsp' starting page</title>
  </head>
  <body>
     <%!double getarea(double s,double x,double g){
           double area=(s+x)*g/2;
           return area;
   } %>
   <%
   String string=request.getParameter("s");
   double s1=Double.parseDouble(string);
   string=request.getParameter("x");
   double x1=Double.parseDouble(string);
   string=request.getParameter("g");
   double g1=Double.parseDouble(string);
   double area=getarea(s1, x1, g1);
   
   out.print("梯形的上底是"+s1+"下底是"+x1+"高是"+g1+"面积是"+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+"/";
%>
 <%!double r=(int)(Math.random()*10)+1; %>
<jsp:include page="circle.jsp">
<jsp:param name="r" value="7"/>
</jsp:include>
<br>
<jsp:include page="ladder.jsp">
<jsp:param name="s" value="7"/>
<jsp:param name="x" value="7"/>
<jsp:param name="g" value="7"/>
</jsp:include>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'index1.jsp' starting page</title>
  </head>
  <body>
 
   
   
  </body>
</html>

 

 3.任务三、

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%="bottom.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%="left.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%="right.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%="top.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 'index1.jsp' starting page</title>
  </head>
  <body >
  <table border="1" width="600" align="center" bgcolor="yellow">
  <tr align="center"><td colspan="2"><%@include file="top.jsp" %></td></tr>
  <tr align="center"><td><%@include file="left.jsp" %></td><td align="center"><%@include file="right.jsp" %></td></tr>
  <tr align="center"><td colspan="2"><%@include file="bottom.jsp" %></td></tr>
  </table>
   
  </body>
</html>

 

 

4.任务四、

复制代码
<%@ 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 'index1.jsp' starting page</title>
  </head>
  <body>
  <%
  String r=request.getParameter("i");
  int x=Integer.parseInt(r);
  out.print("随机数"+x); %>
  Hello,我是奇数!!!
   
  </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 'index1.jsp' starting page</title>
  </head>
  <body>
    <%
  String r=request.getParameter("i");
  int x=Integer.parseInt(r);
  out.print("随机数"+x); %>
    Hello,我是偶数!!!
  </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 'index1.jsp' starting page</title>
</head>
<body>
    <%
        int i = (int) (Math.random() * 10 + 1);
        if (i % 2 == 0) {
    %>
    <jsp:forward page="ou.jsp">
        <jsp:param value="<%=i %>" name="i" />
    </jsp:forward>
    <%
        } else {
    %>
    <jsp:forward page="ji.jsp">
        <jsp:param value="<%=i %>" name="i" />
    </jsp:forward>
    <%
        }
    %>
</body>
</html>

 

标签:周业,代码,第五次,复制,jsp,JSP,index1,My
来源: https://www.cnblogs.com/a15941301273/p/16095565.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有