将需要使用的jar包复制到Tomcat\lib目录下
JSP代码:
<%@ page import="java.util.ArrayList" %>
<%@ page import="NumberProcess.Num" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<title>JSP - Demo2</title>
</head>
<body>
<%
out.print("开始生成随机数...<br>");
ArrayList<Integer> list = new ArrayList<>();
for (int i = 0;i < 100;++i)
{
list.add(Num.getRandomNumber(100, 200));
}
for (int i = 0;i < list.size();++i)
{
out.print(list.get(i) + " ");
}
%>
</body>
</html>
效果: