• jsp第三周作业


    main.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>
      <body>
      <%double r=2,a=3,b=4,h=5; %>
      
    <br>circle
           <jsp:include page="circle.jsp">
           <jsp:param value="<%= r %>" name="R"/>
           </jsp:include>
         
     <br>ladder
             <jsp:include page="ladder.jsp">
              <jsp:param value="<%= a %>" name="A"/>
              <jsp:param value="<%= b %>" name="B"/>
              <jsp:param value="<%= h %>" name="H"/>
              </jsp:include>      
       </body>
    </html>

    circle.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>
     
      
      <body>
        
        <%
        String R=request.getParameter("R");
        double r=Double.parseDouble(R);
        double mj=r*r*3.14;
        %>   
        
       <br>传递的半径是:<%=r%>
       <br>圆的面积是:<%=mj%>
      </body>
    </html>

    ladder.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>
    
      
      <body>
    
     <%
          String A=request.getParameter("A");
         String B=request.getParameter("B");
         String H=request.getParameter("H");  
          double a=Double.parseDouble(A); 
          double b=Double.parseDouble(B);
         double h=Double.parseDouble(H);
         double area=(a+b)*h/2;
    %> 
        <br>传递的上底、下底、高是:<%=A%> <%=B %>  <%=H%>
        <br>梯形面积:<%=area %>
    
      </body>
    </html>

  • 相关阅读:
    jQuery proxy详解
    LESSCSS
    JavaScript语法支持严格模式:"use strict"
    C++ 使用cl命令编辑时发生的问题收录
    attachEvent和addEventListener
    Alert方法重写
    广播信道的数据链路层
    js prototype之诡异
    前端开发易忘内容收录
    数据链路层-点对点协议PPP
  • 原文地址:https://www.cnblogs.com/xffzcjlove/p/12542505.html
Copyright © 2020-2023  润新知