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

    1.消费总和

    <%@ page import="java.util.regex.Pattern" %>
    <%@ page import="java.util.regex.Matcher" %><%--
      Created by IntelliJ IDEA.
      User: 86177
      Date: 2021/3/17
      Time: 11:38
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>消费总和</title>
    </head>
    <style>
        body{
            background: black;
        }
    </style>
    <%!
        public double getPriceSum(String input){
            Pattern pattern;
            Matcher matcher;
            String regx="-?[0-9][0-9]*[.]?[0-9]*";
            pattern=Pattern.compile(regx);
            matcher=pattern.matcher(input);
            double sum=0;
            while (matcher.find()){
                String str=matcher.group();
                sum+=Double.parseDouble(str);
            }
            return sum;
        }
    %>
    <body>
    <p style="font-family: 黑体;font-size:20px;color: aqua">
        <span style="color: red">孙何伟</span>的菜单 <br>
        <%
            String str="麻婆豆腐:20.6元,红烧肉:68.9元";
        %>
        <br><%=str%>
        <br>
        <br>消费总和: <span style="color: chartreuse"><%= getPriceSum(str)%></span></p>
    <hr size="4">
    <p style="font-family: 黑体;font-size:20px;color: pink">
        <span style="color: red">sun he wei is sb</span>的菜单 <br>
        <%
             str="剁椒鱼头:62.9元,烤鸭:199元,红焖大虾:288.9元";
        %>
        <br><%=str%>
        <br>
        <br>消费总和: <span style="color: chartreuse"><%= getPriceSum(str)%></span></p>
    </body>
    </html>

     2.日期时间

    <%@ page import="java.util.Date" %>
    <%@ page import="java.text.SimpleDateFormat" %><%--
      Created by IntelliJ IDEA.
      User: 86177
      Date: 2021/3/17
      Time: 11:38
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>日期时间</title>
    </head>
    <%
        Date date=new Date();
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time=sdf.format(date);
    %>
    <body>
    <h1>显示访问页面的时期、时间</h1>
    <p style="color: black;font-size: 35px">(服务器端的日期、时间)</p>
    <p style="font-size: 20px;font-weight: 700">用户在 <span style="color: red"><%=time%></span> 访问了该网页。</p>
    </body>
    </html>

     3.听英语

    <%--
      Created by IntelliJ IDEA.
      User: 86177
      Date: 2021/3/17
      Time: 11:38
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>听英语</title>
    </head>
    <style>
        body{
            background: black;
            color: aqua;
        }
    </style>
    <body>
    英文课文(English Text): <br>
    <p style="font-family: 宋体;font-size: 18px;color: azure">
        <jsp:include page="english/english.text" flush="true"/>
    课文音频(English Audio):<br>
        <jsp:include page="audio.jsp"/>
    </p>
    </body>
    </html>
    <%--
      Created by IntelliJ IDEA.
      User: 86177
      Date: 2021/3/17
      Time: 12:57
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>Title</title>
    </head>
    <style>
        body{
            /*background: black;*/
        }
    </style>
    <body>
    <embed src="english/CMJ%20-%20所念皆星河.mp3" autostart="flase">
    课文音频在左边
    </embed>
    </body>
    </html>

  • 相关阅读:
    AJAX跨域问题解决方法(3)——被调用方解决跨域
    AJAX跨域问题解决方法(2)——JSONP解决跨域
    AJAX跨域问题解决方法(1)——禁止浏览器进行跨域限制
    AJAX跨域问题解决思路
    产生AJAX跨域问题的原因
    WebStorm配置Vue开发环境
    (2012年旧文)纪念史蒂夫乔布斯---IT界的普罗米修斯
    嵌入式平台组件白盒测试gcov、lcov和genhtml 使用指导
    嵌入式平台使用gtest进行白盒测试
    【转】Python中执行cmd的三种方式
  • 原文地址:https://www.cnblogs.com/skyfail/p/14548773.html
Copyright © 2011-2022 走看看