zoukankan      html  css  js  c++  java
  • Day03_21-Jsp第三次作业

    main.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    
    <%
    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>
      <!--     main.jsp
                include动作标记加载到circle.jsp和ladder.jsp 
                param提供圆的半径和梯形的上下底和高。
            cricle.jsp
                显示圆的面积
            ladder.jsp
                显示梯形面积 
            -->
        <base href="<%=basePath%>">
        
        <title>My JSP 'main.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>
        <jsp:include page="cricle.jsp">
            <jsp:param value="3" name="R"/>
        </jsp:include>
     <jsp:include page="ladder.jsp">
            <jsp:param value="2" name="Upb"/>
            <jsp:param value="4" name="Downb"/>
            <jsp:param value="5" name="H"/>
        </jsp:include>
      </body>
    </html>

    cricle.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%
    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 'cricle.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>
           <%     String r = request.getParameter("R"); 
               int R = Integer.parseInt(r);
               out.print("半径为:"+ r + ",面积为:" + Math.PI * R * R);
           %>
           <br/>
      </body>
    </html>

    ladder.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%
        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>
    
    <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>
        <%
            String Up = request.getParameter("Upb");
            String Down = request.getParameter("Downb");
            String H = request.getParameter("H");
            int upB = Integer.parseInt(Up);
            int downB = Integer.parseInt(Down);
            int h = Integer.parseInt(H);
            out.println("上底为:" + Up + ",下底为:" + Down + ",高为:" + H);
            out.print("梯形的面积为:" + ((upB + downB) * h) / 2);
        %>
    </body>
    </html>

  • 相关阅读:
    浅谈数据的离散化
    【ZOJ】3785 What day is that day? ——浅谈KMP在ACM竞赛中的暴力打表找规律中的应用
    【Python】iichats —— 命令行下的局域网聊天程序
    【Python】iiblogs ——命令行下的网页收藏夹
    【Python】iiacm_filemaker ——简易的.cpp文件创建即初始化脚本,ACMer专用
    【黑科技】读写优化
    【POJ】1330 Nearest Common Ancestors ——最近公共祖先(LCA)
    【HDU】1717 小数化分数2 ——计数原理
    【POJ】2318 TOYS ——计算几何+二分
    【HDU】4923 Room and Moor(2014多校第六场1003)
  • 原文地址:https://www.cnblogs.com/zwcg/p/12538573.html
Copyright © 2011-2022 走看看