多线程实现单词个数统计并展示在页面

读写文件类:

多线程实现单词个数统计并展示在页面_第1张图片

示例文件内容为:

There is no doubt that Road and Belt is the hottest issue recently.
The media report the news all the time and we feel the power when we see our government holding the meetings.
A lot of countries have joined the team and made this policy effective.
Road and Belt brings great chances to China and other countries.
Chinese government plays the important role, which shows its increasing power in the current situation.
Since the 1990s, Chinese economy increased and opened the new chapter every ten years.
The world sense the great market potential and many foreign companies come to China to seek for cooperation.
Road and Belt opens the door for both sides, which is a win-win situation. In the future, China will become the first economy, which has been predicted by the experts. We are lucky to witness the change.

MyThread线程类

多线程实现单词个数统计并展示在页面_第2张图片

单词分组类(使用线程池)

多线程实现单词个数统计并展示在页面_第3张图片

NormalService类

多线程实现单词个数统计并展示在页面_第4张图片

initCtrl类

多线程实现单词个数统计并展示在页面_第5张图片

首先需要导入的依赖

多线程实现单词个数统计并展示在页面_第6张图片

web.xml配置

多线程实现单词个数统计并展示在页面_第7张图片

index.jsp内容

多线程实现单词个数统计并展示在页面_第8张图片

运行结果一览

多线程实现单词个数统计并展示在页面_第9张图片

本次练习让我能够了解多线程完成工作的方法,有趣又快乐,keep moving!

你可能感兴趣的:(Servlet学习)