zoukankan      html  css  js  c++  java
  • jsp第三次作业

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ include file="circle.jsp" %>
    <%@ include file="ladder.jsp" %>   
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; 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>
        <div>
            <form action="main.jsp">
           请输入梯形的上底: <input type="text" name="a"> <br>
           请输入梯形的下底: <input type="text" name="b" > <br>
           请输入梯形的高: <input type="text" name="h"> <br>
             <input type="submit" value="计算结果"> <br><br>
             </form>
         </div>
              <%
            String a=request.getParameter("a");
            String b=request.getParameter("b");
            String h=request.getParameter("h");
            if(a!=null&&b!=null&&h!=null){
                double A=Double.parseDouble(a);
                double B=Double.parseDouble(b);
                double H=Double.parseDouble(h);
                double M=(A+B)*H/2;
                out.print("梯形的面积为:"+M);
                request.setAttribute("A", a);
                request.setAttribute("B", b);
                request.setAttribute("H", h);
                request.setAttribute("M", M);
            }
        %>
    </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>
        <div>
            <form action="main.jsp">
                    请输入圆的半径:<input type="text"  name="R" > <br>
                    <em id="__mceDel">         <input type="submit" value="计算结果"> <br>
            </form>
        </div>
        <%
            String R=request.getParameter("R");
            if(R!=null){
                double PI=3.14;
                double r=Double.parseDouble(R);
                double area=r*r*3.14;
                out.print("圆的面积为"+area);
                request.setAttribute("r", r);
                request.setAttribute("area", area);
            } 
        %>
    </body>
    </html>
    </em>

     

  • 相关阅读:
    py2与py3的字符编码的区别
    深浅拷贝大法
    列表、字典、元组、集合的内置方法
    数据类型的内置方法
    与while和for的爱恨情仇
    三种格式化输出以及运算符和if
    在outlook中发邮件判断邮件发送成功的方法
    修練營ASP.NET]淺談多層式架構 (Multi Tiers)
    软考编译原理小结
    0型文法、1型文法、2型文法、3型文法
  • 原文地址:https://www.cnblogs.com/xiaohusha/p/12563890.html
Copyright © 2011-2022 走看看