zoukankan      html  css  js  c++  java
  • 3.17jsp

    1

    <%@ page contentType = "text/html"%>
    <%@ page pageEncoding ="utf-8"%>
    <%@ page import="java.util.regex.Pattern" %>
    <%@ page import="java.util.regex.Matcher" %>
    <%!
    public double getPriceSum(String input){
        Pattern pattern;
        Matcher matcher;
        String regex = "-?[0-9][0-9]*[.]?[0-9]*";
        pattern = Pattern.compile(regex);
        matcher = pattern.matcher(input);
        double sum =0;
        while(matcher.find()){
            String str = matcher.group();
            sum += Double.parseDouble(str);    
        }
        return sum;
    }
     %>
    <HTML>
    <body bgcolor = cyan >
    <p style = "font-family:黑体;font-size:20">
    <br>张三的菜单:</br>
    <% String str = "麻婆豆腐:20.6元,红烧肉:68.9元"; %>
    <br> <%=str%></br>
    <br><b><i>消费总和;<%=getPriceSum(str) %></i></b></br>
    <br>李四的菜单:</br>
    <% str = "剁椒鱼头:62.9元,烤鸭:199元,油闷大虾;289.9元"; %>
    <br> <%=str%></br>
    <br><b><i>消费总和;<%=getPriceSum(str) %></i></b></br>
    </p>
    </body>
    </HTML>

     2

    <%@ page contentType="text/html" %>
    <%@ page pageEncoding="utf-8" %>
    <html>
     
    <body bgcolor=cyan>
     
        <br>英文课文(English Text):</br>
        <p style="font-family: 宋体;font-size: 18;color: black;">
    
            <br>课文音频(English Audio):</br>
            <jsp:include page="audio.jsp" />
        </p>
    </body>
     
    </html>>
    <%@ page contentType="text/html" %>
    <%@ page pageEncoding="utf-8" %>
    <html>
     
    <body bgcolor=pink>
        <embed src="english/english.mp3" autostart=false>
        课文音频
        </embed>
    </body>
     
    </html>

     3

    <%@ page contentType="text/html" %>
    <%@ page pageEncoding="utf-8"%>
    <%@ page import="java.time.LocalDate" %>
    <%@ page import="java.time.LocalTime" %>
    <%
        LocalDate date=LocalDate.now();
        LocalTime time=LocalTime.now();
    %>
    <h2>
    用户在<%=date.getYear()%>/<%=date.getMonthValue()%>/
    <%=date.getDayOfMonth()%><br>
    <%=time.getHour()%>:<%=time.getMinute()%>:<%=time.getSecond()%>访问了网页。
    </h2>
    <%@ page contentType="text/html" %>
    <%@ page pageEncoding="utf-8" %>
    
    <html><body>
    <h1>显示访问网页的日期时间<br>(服务器端的日期时间)</h1>
    <%@ include file = "time.jsp" %>
    </body>></html>>
  • 相关阅读:
    JavaScript内存泄漏(转)
    深入理解JavaScript的变量作用域(转)
    Spring MVC 配置(备忘)
    French fashion in Paris
    Windows Server 2003、 WindowsXP, 中和 Windows 2000 中的缓存凭据安全
    doc.txt.exe病毒。
    Exchange server 增加RBL
    无以穷尽的工作。。。
    windows SBS Exchange 数据库恢复
    VLAN介绍
  • 原文地址:https://www.cnblogs.com/zjzj123/p/14590147.html
Copyright © 2011-2022 走看看