<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import ="java .util.regex.Pattern" %>
<%@ page import ="java .util.regex.Matcher" %>
<!DOCTYPE html>
<html>
<head>
<%!
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;
}
%>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor = cyan>
<p style = "font-family;黑体;font-size:20">
<br>张三的菜单:
<% String str = "麻婆豆腐:20.6元,红烧肉:68.9元"; %>
<br><%= str %>
<br><b><i>消费总和:<%= getpriceSum(str) %></i></b>
<br>利斯的菜单:
<% str = "剁椒鱼头:62.9元,烤鸭:199元,红焖大虾:289.9元"; %>
<br><%= str %>
<br><b><i>消费总和:<%= getpriceSum(str) %></i></b>
</p>
</table>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>
显示访问网页的日期、时间
<br>
(服务器端的日期、时间)
</h1>
<%@ include file = "timeFile.jsp" %>
</body>
</html>
<%@ page language="java"
pageEncoding="UTF-8"%>
<%@ page import = "java.time.LocalDate" %>
<%@ page import = "java.time.LocalTime" %>
<%
LocalDate date = LocalDate.now();
LocalTime time = LocalTime.now();
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h2>
用户在<%= date.getYear() %>/<%= date.getMonthValue() %>/
<%= date.getDayOfMonth() %><br>
<%= time.getHour() %>:<%= time.getMinute() %>:<%= time.getSecond() %>
访问了网页
</h2>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor = cyan>
<br>英文课文(English Text):
<br>
<p style = "font-family:宋体;font-size:18;color:black">
<br>课文音频(English Audio):
<br>
<jsp:include page="NewFile.jsp"></jsp:include>
</p>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor = pink>
<embed src="english/english.mp3" autostart ="false" >
</body>