• JSP第三次作业


    cricle

    <%@ 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 '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 +"   "+ "园的面积为:" + 3.14 * R * R);
           %>
      </body>
    </html>

    ladder

    <%@ 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>
        
        <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 shangdi = request.getParameter("shangdi");
            String xiadi = request.getParameter("shangdi");
            String gao = request.getParameter("xiadi"); 
            int shang = Integer.parseInt(shangdi);
            int xia = Integer.parseInt(xiadi);
            int g = Integer.parseInt(gao);
            out.println("上底为:" + shangdi + ",下底为:" + xiadi + ",高为:" + gao);
            out.print("梯形的面积为:" + ((shang + xia) * g) / 2);
        %>
      </body>
    </html>

    main

    <%@ 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 '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="12" name="R"/>
        </jsp:include>
        <br>
     <jsp:include page="ladder.jsp">
            <jsp:param value="6" name="shangdi"/>
            <jsp:param value="3" name="xiadi"/>
            <jsp:param value="3" name="gao"/>
        </jsp:include>
      </body>
    </html>

  • 相关阅读:
    什么是遍历?
    jQuery 尺寸 方法
    jQuery 操作 CSS
    删除元素/内容
    通过 after() 和 before() 方法添加若干新元素
    通过 append() 和 prepend() 方法添加若干新元素
    四个 jQuery 方法:
    设置内容
    jQuery 属性选择器
    jQuery 元素选择器
  • 原文地址:https://www.cnblogs.com/wangtianpeng/p/12541740.html
Copyright © 2020-2023  润新知