• JSP第三次作业


    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ include file="circle.jsp" %>
    <%@ include file="ladder.jsp" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
        <div>
            <form action="main.jsp">
                <input type="number" name="A" placeholder="请输入梯形的上底"><br>
                <input type="number" name="B" placeholder="请输入梯形的下底"><br>
                <input type="number" name="H" placeholder="请输入梯形的高"><br>
                <input type="submit" value="计算">
            </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 ls=(a+b)*h/2;
                out.print("梯形的面积为:"+ls);
                request.setAttribute("a", a);
                request.setAttribute("xd", b);
                request.setAttribute("h", h);
                request.setAttribute("ls", ls);
            }
        %>
    </body>
    </html>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <div>
            <form action="main.jsp">
                <input type="number" name="R" placeholder="请输入圆的半径"><br>
                <input type="submit" value="计算">
            </form>
        </div>
        <%
            String R=request.getParameter("R");
            if(R!=null){
                double r=Double.parseDouble(R);
                double s=r*r*3.14;
                out.print("圆的面积为"+s);
                request.setAttribute("s", s);
            }
        %>
    </body>
    </html>

  • 相关阅读:
    5招教你实现多线程场景下的线程安全!
    跟我读论文丨ACL2021 NER BERT化隐马尔可夫模型用于多源弱监督命名实体识别
    大数据集群跨多版本升级、业务0中断,只因背后有TA
    云小课 | 到底什么是区块链?
    信创产业已成现象级新风口,快来加入争做“弄潮儿”
    教你如何使用FusionInsight SqoopShell
    【Kubernetes】镜像拉取策略-IfNotPresent
    【Kubernetes】镜像拉取策略-Always
    【Kubernetes】env 注入资源
    【Kubernetes】env 注入字段值
  • 原文地址:https://www.cnblogs.com/shenxiaoqi/p/12562509.html
Copyright © 2020-2023  润新知