zoukankan      html  css  js  c++  java
  • JSP第三次课后作业 2021/03/17

    实验一 p37

    <%@ page import="java.util.regex.Matcher" %>
    <%@ page import="java.util.regex.Pattern" %>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%!
      public double getPriceSum(String str){
        Pattern pattern;
        Matcher matcher;
        String regex = "-?[0-9][0-9]*[.]?[0-9]*";
        pattern = Pattern.compile(regex);
        matcher = pattern.matcher(str);
        double sum = 0;
        while(matcher.find()){
          String string = matcher.group();
          sum += Double.parseDouble(string);
        }
        return sum;
      }
    %>
    <html>
      <style>
        h3{
          color: aquamarine;
        }
        p{
          color: darkorchid;
        }
      </style>
      <body>
      <h3>张三的菜单</h3>
      <p><% String str = "宫保鸡丁:55.55,麻辣豆腐:33.33";%></p>
      <p><%=str%></p>
      <i>消费总和:<%=getPriceSum(str)%></i><br>
      <hr>
      <h3>李四的菜单</h3>
      <p><% String str1 = "酸菜鱼:33.33,水煮肉片:66.66";%></p>
      <p><%=str1%></p>
      <i>消费总和:<%=getPriceSum(str1)%></i><br>
      </body>
    </html>

    实验二 p39

    userTime.jsp

    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <body>
        <a href="time.jsp">显示访问网页的日期、时间</a>
    </body>
    </html>

    time.jsp

    <%@ page import="java.util.Date" %>
    <%@ page import="java.text.SimpleDateFormat" %>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <style>
        h3{
            color: darkgray;
        }
    </style>
    
    <body>
        <h3>
            用户在
            <%Date date = new Date();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            %>
            <%=sdf.format(date)%>
            访问了网页
        </h3>
    </body>
    </html>

    实验三 p39

    audio.jsp

    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    
    <body bgcolor="#faebd7">
    <embed src="song/song.mp3" autostart="false">
    歌曲音频
    </embed>
    </body>
    </html>

    listenSong.jsp

    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <style>
        p{
            font-family: "宋体";
            font-size: 18px;
            color: darkorchid;
        }
    </style>
    <body bgcolor="#5f9ea0">
        音乐歌词<br>
    <p>
        <jsp:include page="song/geci.txt"></jsp:include>
        歌曲音频<br>
        <jsp:include page="audio.jsp"></jsp:include>
    </p>
    </body>
    </html>

  • 相关阅读:
    关于苹果IPhone/Ipad(IOS)开发者证书申请及安装、真机调试、发布的参考文章
    vs 关闭警告
    真机测试及布署Code Sign error问题总结
    在 Win32 Application 和 Win32 Console Application 中使用 MFC
    获取应用程序路径的区别
    js日期控件
    SQL SERVER 企业管理器 MMC 无法创建管理单元
    进程查看两利器
    用PowerDesigner逆向数据库工程时”Unable to list the table"错误的解决方法
    SQL 附加无日志数据库
  • 原文地址:https://www.cnblogs.com/lilbetter03/p/14551239.html
Copyright © 2011-2022 走看看