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 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>

  • 相关阅读:
    linux 中more、less 和 most 的区别
    mysql数据备份之 xtrabackup
    Web登录中的信心安全问题
    Yii2.0教程应用结构篇 —— 入口脚本
    HTML基础之JS
    HTML基础之DOM操作
    HTML基础之CSS
    HTML基础之HTML标签
    Python之unittest参数化
    Python之单元测试unittest
  • 原文地址:https://www.cnblogs.com/shenxiaoqi/p/12562509.html
Copyright © 2011-2022 走看看