• jsp.3(补)


    2.81

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

    <%@ page import="java.util.regex.Pattern"%>
    <%@ page import="java.util.regex.Matcher"%>
    <%!public double getPirceSum(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;
    }%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    </head>
    <body>
    张三的菜单
    <br>
    <%
    String str = "麻辣豆腐:20.6元,猪肘子:68.0元";
    %>
    <%=str%><br>
    <b>消费总额:<%=getPirceSum(str)%></b>
    </body>
    </html>

    <%@ page language="java" import="java.util.Date" pageEncoding="utf-8"%>
    <%@page contentType="text/html" %>

    <%
    Date date = new Date();

    %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    </head>

    <body>
    <h2>
    用户在<%=date.getYear()%>/<%=date.getMonth()+1%>/
    <%=date.getDate()%><br>
    <%=date.getHours()%>:<%=date.getMinutes()%>:<%=date.getSeconds()%>访问了网页.
    </h2>
    </body>
    </html>

    2.82

     index.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <%@ page import="java.time.LocalDate"%>
    <%@ page import="java.time.LocalTime"%>
    <%
    LocalDate date = LocalDate.now();
    LocalTime time = LocalTime.now();
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    </head>

    <body>
    <h2>
    用户在<%=date.getYear()%>/<%=date.getMonthValue()%>/
    <%=date.getDayOfMonth()%><br>
    <%=time.gettHour()%>:<%=time.gettHour()%>:<%=time.gettHour()%>:<%=time.getSecond()%>访问了网页
    </h2>
    </body>
    </html>

    userTime.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    </head>

    <body>
    <h1>显示访问网页的日期、时间<br>(服务器端的日期、时间)</h1>
    <%@ include="index.jsp" %>
    </body>
    </html>

    2.83

    index.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    </head>

    <body>
    <p>文本内容</p>
    <jsp:include page="english/text.txt" />
    <br>
    <p>音频内容</p>
    <jsp:include page="audio.jsp" />
    </body>
    </html>

    audio.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    </head>

    <body>
    <embed src="english/Jason李小西 - 廻廻奇譚 (Live).mp3" autostart=false>
    音频
    </body>
    </html>

  • 相关阅读:
    雅米新一代企业管理平台
    Telerik.Web.UI应用到sharepoint2010注意事项
    SharePoint Server 2010 容量管理:软件边界和限制
    【读】构建可枚举类型(IEnumerator和IEnumerable)
    【读】C# 窗口间传递数据
    分类(转)
    “盗”亦有道
    English学习指南
    爱情是什么?
    客户需要的26个待遇 (转)
  • 原文地址:https://www.cnblogs.com/wu-di-821-821/p/14649774.html
Copyright © 2020-2023  润新知