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>

  • 相关阅读:
    前后端分离开发中动态菜单的两种实现方案
    Spring Security 前后端分离登录,非法请求直接返回 JSON
    Spring Boot2 系列教程(九)Spring Boot 整合 Thymeleaf
    原创的离线版 Redis 教程,给力!
    Spring Boot2 系列教程(八)Spring Boot 中配置 Https
    Anaconda创建环境、删除环境、激活环境、退出环境
    开源一个功能完整的SpringBoot项目框架
    Spring Boot和Spring Cloud学习资源推荐
    Ubuntu 18.04下安装Steam顶级在线游戏平台
    终极手撕之架构大全:分布式+开源框架+微服务+性能优化,够不够?
  • 原文地址:https://www.cnblogs.com/skyfail/p/14548773.html
Copyright © 2011-2022 走看看