20210617日报

第一阶段目标

1、数据爬取:用户可爬取论文的题目、摘要、关键词、原文链接;

2、多条件查询:可进行论文检索,当用户输入论文编号、题目、关键词等基本信息,分析返回相关的paper、source code、homepage等信息;

第二阶段目标

1、热词分析:对爬取的信息进行结构化处理,分析top10个热门领域或热门研究方向;

2、可视化:形成如关键词图谱之类直观的查看方式;

截图:

(1)首页

 (2)显示论文信息页面

 (3)显示论文热词页面

 

 源码:

(1)Word

package Bean;

public class Word {
    private String id;
    private String title;
    private String year;
    private String link;
    private String zhaiyao;
    private String keywords;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getYear() {
        return year;
    }
    public void setYear(String year) {
        this.year = year;
    }
    public String getLink() {
        return link;
    }
    public void setLink(String link) {
        this.link = link;
    }
    public String getZhaiyao() {
        return zhaiyao;
    }
    public void setZhaiyao(String zhaiyao) {
        this.zhaiyao = zhaiyao;
    }
    public String getKeywords() {
        return keywords;
    }
    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }
    public Word() {
        super();
        // TODO Auto-generated constructor stub
    }
    public Word(String id, String title, String year, String link, String zhaiyao, String keywords) {
        super();
        this.id = id;
        this.title = title;
        this.year = year;
        this.link = link;
        this.zhaiyao = zhaiyao;
        this.keywords = keywords;
    }
    
}

(2)Dao

package Dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import Bean.Word;
import Util.DBUtil;

public class Dao {

    public List<Word> show(String keyword) {
        // TODO Auto-generated method stub
        String sql="select * from paper ";//where title like " + keyword + "or year like " + keyword + "or link like " + keyword + "or zhaiyao like " + keyword + "or keywords like " + keyword;
        Connection conn=DBUtil.getConn();
        Statement state=null;
        List<Word> words=new ArrayList<>();
        ResultSet rs=null;
        try {
            state=conn.createStatement();
            rs=state.executeQuery(sql);
            if(rs!=null)
                while(rs.next()) {
                    String id=rs.getString("id");
                    String title=rs.getString("title");
                    String year=rs.getString("year");
                    String link=rs.getString("link");
                    String zhaiyao=rs.getString("zhaiyao");
                    String keywords=rs.getString("keywords");
                    
                    Word word=new Word(id, title, year, link, zhaiyao, keywords);
                    words.add(word);
                }
        }catch (Exception e) {
            e.printStackTrace();
        }finally {
            DBUtil.close(rs, state, conn);
        }
        return words;
    }

    public Boolean delete(String id) {
        // TODO Auto-generated method stub
        String sql="delete from paper where id = '" + id + "'";
        Connection conn=DBUtil.getConn();
        Statement state=null;
        int a=0;
        try {
            state=conn.createStatement();
            a=state.executeUpdate(sql);
        }catch (Exception e) {
            e.printStackTrace();
        }finally {
            DBUtil.close(state, conn);
        }
        if(a>0)
            return true;
        else
            return false;
    }

    public List<Word> search(String title, String year, String zhaiyao, String keyword) {
        // TODO Auto-generated method stub
        String sql="select * from paper";//where title like " + keyword + "or year like " + keyword + "or link like " + keyword + "or zhaiyao like " + keyword + "or keywords like " + keyword;
        if(!"".equals(title)) {
            sql+="where title like '" + title + "'";
            if(!"".equals(year)) {
                sql+="or where year like '" + year + "'";
            }
            if(!"".equals(zhaiyao)) {
                sql+="or where zhaiyao like '" + zhaiyao + "'";
            }
            if(!"".equals(keyword)) {
                sql+="or where keyword like '" + keyword + "'";
            }
        }
        else {
            if(!"".equals(year)) {
                sql+="where year like '%" + year + "%'";
                if(!"".equals(zhaiyao)) {
                    sql+="or where zhaiyao like '" + zhaiyao + "'";
                }
                if(!"".equals(keyword)) {
                    sql+="or where keyword like '" + keyword + "'";
                }
            }
            else {
                if(!"".equals(zhaiyao)) {
                    sql+="where zhaiyao like '" + zhaiyao + "'";
                    if(!"".equals(keyword)) {
                        sql+="or where keyword like '" + keyword + "'";
                    }
                }
                else {
                    if(!"".equals(keyword)) {
                        sql+="where keywords like '" + keyword + "'";
                    }
                }
            }
        }
        Connection conn=DBUtil.getConn();
        Statement state=null;
        List<Word> words=new ArrayList<>();
        ResultSet rs=null;
        try {
            state=conn.createStatement();
            rs=state.executeQuery(sql);
            if(rs!=null)
                while(rs.next()) {
                    String id=rs.getString("id");
                    String title1=rs.getString("title");
                    String year1=rs.getString("year");
                    String link=rs.getString("link");
                    String zhaiyao1=rs.getString("zhaiyao");
                    String keywords=rs.getString("keywords");
                    
                    Word word=new Word(id, title1, year1, link, zhaiyao1, keywords);
                    words.add(word);
                }
        }catch (Exception e) {
            e.printStackTrace();
        }finally {
            DBUtil.close(rs, state, conn);
        }
        return words;
    }
    public List<Word> search1(String title, String year, String zhaiyao, String keyword) {
        String sql="select * from paper where title like" +" '%deep%' ";
        Connection conn=DBUtil.getConn();
        Statement state=null;
        List<Word> words=new ArrayList<>();
        ResultSet rs=null;
        try {
            state=conn.createStatement();
            rs=state.executeQuery(sql);
            while (rs.next()) {
                String id=rs.getString("id");
                String title1=rs.getString("title");
                String year1=rs.getString("year");
                String link=rs.getString("link");
                String zhaiyao1=rs.getString("zhaiyao");
                String keywords=rs.getString("keywords");
                
                Word word=new Word(id, title1, year1, link, zhaiyao1, keywords);
                words.add(word);
            }
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }
        finally {
            DBUtil.close(rs, state, conn);
        }
        return words;
    }

}

(3)WordServlet

package Servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Bean.Word;
import Dao.Dao;

/**
 * Servlet implementation class Servlet
 */
@WebServlet("/WordServlet")
public class WordServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * Default constructor. 
     */
    public WordServlet() {
        // TODO Auto-generated constructor stub
    }
    Dao dao = new Dao();

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String method=req.getParameter("method");
        if("show".equals(method)) {
            show(req,resp);
        }
        if("search".equals(method)) {
            search(req,resp);
        }
        if("delete".equals(method)) {
            delete(req,resp);
        }
        if("show1".equals(method)) {
            show1(req,resp);
        }
    }

    private void show1(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        req.setCharacterEncoding("utf-8");
        String num =req.getParameter("num");
        if (num.equals("10")){
            req.getRequestDispatcher("word_10.jsp").forward(req,resp);
        }else if (num.equals("5")){
            req.getRequestDispatcher("word_5.jsp").forward(req,resp);
        }else {
            req.getRequestDispatcher("words.jsp").forward(req,resp);
        }
    }

    private void search(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        req.setCharacterEncoding("utf-8");
        String title=req.getParameter("title");
        String year=req.getParameter("year");
        String zhaiyao=req.getParameter("zhaiyao");
        String keyword=req.getParameter("keyword");
        List<Word> words=dao.search1(title,year,zhaiyao,keyword);
        System.err.println(words+year);
        req.setAttribute("words", words);
        req.getRequestDispatcher("show.jsp").forward(req, resp);
    }

    private void delete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        req.setCharacterEncoding("utf-8");
        String id=req.getParameter("id");
        String keyword=req.getParameter("keyword");
        Boolean b=dao.delete(id);
        if(b) {
            req.setAttribute("message", "删除成功!");
        }
        else {
            req.setAttribute("message", "删除失败!");
        }
        List<Word> words=dao.show(keyword);
        req.setAttribute("words", words);
        req.getRequestDispatcher("show.jsp").forward(req, resp);
    }

    private void show(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        req.setCharacterEncoding("utf-8");
        String keyword=req.getParameter("keyword");
        List<Word> words=dao.show(keyword);
        req.setAttribute("words", words);
        req.getRequestDispatcher("show.jsp").forward(req, resp);
    }

}

(4)DBUtil

package Util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DBUtil {
    
    public static String db_url = "jdbc:mysql://localhost:3306/words?useSSL=false";
    public static String db_user = "root";
    public static String db_pass = "001206";
    
    public static Connection getConn () {
        Connection conn = null;
        
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection(db_url, db_user, db_pass);
        } catch (Exception e) {
            e.printStackTrace();
        }
        
        return conn;
    }
    
    /**
     * �ر�����
     * @param state
     * @param conn
     */
    public static void close (Statement state, Connection conn) {
        if (state != null) {
            try {
                state.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
    
    public static void close (ResultSet rs, Statement state, Connection conn) {
        if (rs != null) {
            try {
                rs.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        
        if (state != null) {
            try {
                state.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

}

(5)main.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>首页</title>
</head>
<style>
    a:link{
        color:blue;
    }
    a:visited{
        color:blue;
    }
    a:hover{
        color:red;
    }
    a{
        font-size:22px;
        font-family:"楷体";
        font-weight:2px;
    }
    h1{
        color:red;
        font-size:44px;
    }
</style>
<body>
    <h1 align="center">论文基本信息操作</h1>
    <a href="WordServlet?method=show"><h2 align="center">浏览论文基本信息</h2></a>
    <a href="words.jsp"><h2 align="center">浏览热词基本信息</h2></a>
</body>
</html>

(6)show.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>显示论文信息页面</title>
</head>
<style>
    a:link{
        color:blue;
    }
    a:visited{
        color:blue;
    }
    a:hover{
        color:red;
    }
    a{
        font-size:22px;
        font-family:"楷体";
        font-weight:2px;
    }
    h1{
        color:red;
        font-size:44px;
    }
    table{
        table-layout:fixed;
        100%;
    }
    td {
        white-space:nowrap;/*文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。*/
        overflow:hidden;/*隐藏多余的内容*/
        -moz-text-overflow: ellipsis; /* for Firefox,mozilla */
    }
</style>
<body>
    <%  Object message=request.getAttribute("message");
        if(message!=null&&!"".equals(message)){%>
        <script type="text/javascript">
            alert("<%=request.getAttribute("message")%>");
            request.setAttribute(message,"");
        </script>
    <%  }%>
    <div align="center">
        <h1 style="color: red;" align="center"> 所有论文基本信息列表</h1>
        <a href="WordServlet?method=show"><h2 align="center">浏览论文基本信息</h2></a>
        <a href="words.jsp"><h2 align="center">浏览热词基本信息</h2></a>
        <form action="WordServlet?method=search"  method="post">
            <h3>
                标题<input type="text" name="title" id="title">
                年份<input type="text" name="year" id="year">
                摘要<input type="text" name="zhaiyao" id="zhaiyao">
                关键字<input type="text" name="keyword" id="keyword">
                <input type="submit" value="搜索">
                <input type="reset" value="重置">
            </h3>
        </form>
        <table border="1px" cellspacing="0" cellpadding="4px">
             <tr height="35px">
                 <td><h3 style="color: yellow; 5%">编号</h3></td>
                 <td><h3 style="color: yellow; 20%">标题</h3></td>
                 <td><h3 style="color: yellow; 5%">年份</h3></td>
                 <td><h3 style="color: yellow; 30%">链接</h3></td>
                 <td><h3 style="color: yellow; 20%">摘要</h3></td>
                 <td><h3 style="color: yellow; 10%">关键字</h3></td>
                 <td><h3 style="color: yellow; 10%">操作</h3></td>
             </tr>
             <tr height="35px">
             <c:forEach items="${words}" var="item" >
                  <td style="5%">${item.id}</td>
                 <td style="20%">${item.title}</td>
                 <td style="5%">${item.year}</td>
                 <td style="30%"><a href=${item.link}>${item.link}</a></td>
                 <td style="20%">${item.zhaiyao}</td>
                 <td style="10%">${item.keywords}</td>
                 <td style="10%"><a href="WordServlet?method=delete&id=${item.id}" onclick="return firm();">删除</a></td>
             </tr>
             </c:forEach>
        </table>
    </div>
</body>
</html>

(7)word_10.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>查询</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/jquery-3.1.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/echarts-cloud.js"></script>
    <script src="js/echarts.min.js"></script>
    <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>
    <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts-wordcloud.min.js"></script>
</head>
<body>
<style>
    table{
        table-layout:fixed;
        100%;
    }
    td {
        white-space:nowrap;/*文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。*/
        overflow:hidden;/*隐藏多余的内容*/
        -moz-text-overflow: ellipsis; /* for Firefox,mozilla */
    }
    a:link{
        color:blue;
    }
    a:visited{
        color:blue;
    }
    a:hover{
        color:red;
    }
    a{
        font-size:22px;
        font-family:"楷体";
        font-weight:2px;
    }
    h1{
        color:red;
        font-size:44px;
    }
</style>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-3">
            <div class="list-group">
                <a href="WordServlet?method=show"><h2 align="center">浏览论文基本信息</h2></a>
                <a href="words.jsp"><h2 align="center">浏览热词基本信息</h2></a>
            </div>
        </div>
        <div class="col-md-9">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">热词分析 &nbsp;<i class="fa fa-book pull-right" aria-hidden="true"></i></h3>
                </div>
                <div class="panel-body">
                    <div class="panel-body">
                        <form action="WordServlet?method=show1" method="post">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="您要搜索的TOP" name="num"/>
                            </div><!-- /input-group -->
                            <span class="input-group-btn">
                <button class="btn btn-primary" type="submit" >搜索</button>
              </span>
                        </form>
                    </div>
                    </span>
                </div>
                <div id="cy" style=" 800px; height: 600px;">
                </div>
                <div id="tu" style=" 800px; height: 600px;"></div>
            </div>
        </div>
        <table align="center" border="2">
            <tr>
                <td align="center"> 
                    <h2>
                        <a>热词:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>数量:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>image:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>421:</a>
                    </h2>
                </td>
            </tr>
            <tr align="center">
                <td align="center"> 
                    <h2>
                        <a>network:</a>
                    </h2>
                </td>
                <td>
                    <h2>
                        <a>293:</a>
                    </h2>
                </td>
            </tr>
            <tr align="center">
                <td align="center"> 
                    <h2>
                        <a>learn:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>272:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>model:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>236:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>method:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>223:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>ject:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>169:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>use:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>162:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>data:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>161:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>propose:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>160:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>base:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>159:</a>
                    </h2>
                </td>
            </tr>
        </table>
    </div>
</div>

</div>
<script>
    var chart_a38671828dc24de39da3248d8e1eabd8 = echarts.init(
        document.getElementById('cy'), 'white', {renderer: 'canvas'});
    var option_a38671828dc24de39da3248d8e1eabd8 = {
        "animation": true,
        "animationThreshold": 2000,
        "animationDuration": 1000,
        "animationEasing": "cubicOut",
        "animationDelay": 0,
        "animationDurationUpdate": 300,
        "animationEasingUpdate": "cubicOut",
        "animationDelayUpdate": 0,
        "color": [
            "#c23531",
            "#2f4554",
            "#61a0a8",
            "#d48265",
            "#749f83",
            "#ca8622",
            "#bda29a",
            "#6e7074",
            "#546570",
            "#c4ccd3",
            "#f05b72",
            "#ef5b9c",
            "#f47920",
            "#905a3d",
            "#fab27b",
            "#2a5caa",
            "#444693",
            "#726930",
            "#b2d235",
            "#6d8346",
            "#ac6767",
            "#1d953f",
            "#6950a1",
            "#918597"
        ],
        "series": [
            {
                "type": "wordCloud",
                "shape": "diamond",
                "rotationRange": [
                    0,
                    0
                ],
                "rotationStep": 45,
                "girdSize": 20,
                "sizeRange": [
                    20,
                    100
                ],
                "data": [
                    {
                        "name": "image",
                        "value": 428,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(98,52,124)"
                            }
                        }
                    },
                    {
                        "name": "network",
                        "value": 293,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(73,70,71)"
                            }
                        }
                    },
                    {
                        "name": "learn",
                        "value": 273,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(77,17,53)"
                            }
                        }
                    },
                    {
                        "name": "model",
                        "value": 236,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(143,99,105)"
                            }
                        }
                    },
                    {
                        "name": "method",
                        "value": 223,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(94,46,113)"
                            }
                        }
                    },
                    {
                        "name": "ject",
                        "value": 169,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(101,90,2)"
                            }
                        }
                    },
                    {
                        "name": "use",
                        "value": 162,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(101,86,32)"
                            }
                        }
                    },
                    {
                        "name": "data",
                        "value": 161,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(31,61,5)"
                            }
                        }
                    },
                    {
                        "name": "propose",
                        "value": 160,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(87,89,121)"
                            }
                        }
                    },
                    {
                        "name": "base",
                        "value": 144,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(113,86,92)"
                            }
                        }
                    }
                ],
                "drawOutOfBound": false,
                "textStyle": {
                    "emphasis": {}
                }
            }
        ],
        "legend": [
            {
                "data": [],
                "selected": {},
                "show": true,
                "padding": 5,
                "itemGap": 10,
                "itemWidth": 25,
                "itemHeight": 14
            }
        ],
        "tooltip": {
            "show": true,
            "trigger": "item",
            "triggerOn": "mousemove|click",
            "axisPointer": {
                "type": "line"
            },
            "showContent": true,
            "alwaysShowContent": false,
            "showDelay": 0,
            "hideDelay": 100,
            "textStyle": {
                "fontSize": 14
            },
            "borderWidth": 0,
            "padding": 5
        },
        "title": [
            {
                "text": "u8bcdu4e91u56fe",
                "padding": 5,
                "itemGap": 10
            }
        ]
    };
    chart_a38671828dc24de39da3248d8e1eabd8.setOption(option_a38671828dc24de39da3248d8e1eabd8);
</script>
</body>
</html>

(8)word_5.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>查询</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/jquery-3.1.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/echarts-cloud.js"></script>
    <script src="js/echarts.min.js"></script>
    <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>
    <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts-wordcloud.min.js"></script>
</head>
<body>
<style>
    table{
        table-layout:fixed;
        100%;
    }
    td {
        white-space:nowrap;/*文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。*/
        overflow:hidden;/*隐藏多余的内容*/
        -moz-text-overflow: ellipsis; /* for Firefox,mozilla */
    }
    a:link{
        color:blue;
    }
    a:visited{
        color:blue;
    }
    a:hover{
        color:red;
    }
    a{
        font-size:22px;
        font-family:"楷体";
        font-weight:2px;
    }
    h1{
        color:red;
        font-size:44px;
    }
</style>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-3">
            <div class="list-group">
                <a href="WordServlet?method=show"><h2 align="center">浏览论文基本信息</h2></a>
                <a href="words.jsp"><h2 align="center">浏览热词基本信息</h2></a>
            </div>
        </div>
        <div class="col-md-9">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">热词分析 &nbsp;<i class="fa fa-book pull-right" aria-hidden="true"></i></h3>
                </div>
                <div class="panel-body">
                    <div class="panel-body">
                        <form action="WordServlet?method=show1" method="post">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="您要搜索的TOP" name="num"/>
                            </div><!-- /input-group -->
                            <span class="input-group-btn">
                <button class="btn btn-primary" type="submit" >搜索</button>
              </span>
                        </form>
                    </div>
                    </span>
                </div>
                <div id="cy" style=" 800px; height: 600px;">
                </div>
                    <div id="tu" style=" 800px; height: 600px;"></div>
            </div>
        </div>
        <table align="center" border="2">
            <tr>
                <td align="center"> 
                    <h2>
                        <a>热词:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>数量:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>image:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>421:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>network:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>293:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>learn:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>272:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>model:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>236:</a>
                    </h2>
                </td>
            </tr>
            <tr>
                <td align="center"> 
                    <h2>
                        <a>method:</a>
                    </h2>
                </td>
                <td align="center">
                    <h2>
                        <a>223:</a>
                    </h2>
                </td>
            </tr>
        </table>
    </div>
</div>
</div>
</body>
<script>
    var chart_989fe02908e64618a085e023db0f2239 = echarts.init(
        document.getElementById('cy'), 'white', {renderer: 'canvas'});
    var option_989fe02908e64618a085e023db0f2239 = {
        "animation": true,
        "animationThreshold": 2000,
        "animationDuration": 1000,
        "animationEasing": "cubicOut",
        "animationDelay": 0,
        "animationDurationUpdate": 300,
        "animationEasingUpdate": "cubicOut",
        "animationDelayUpdate": 0,
        "color": [
            "#c23531",
            "#2f4554",
            "#61a0a8",
            "#d48265",
            "#749f83",
            "#ca8622",
            "#bda29a",
            "#6e7074",
            "#546570",
            "#c4ccd3",
            "#f05b72",
            "#ef5b9c",
            "#f47920",
            "#905a3d",
            "#fab27b",
            "#2a5caa",
            "#444693",
            "#726930",
            "#b2d235",
            "#6d8346",
            "#ac6767",
            "#1d953f",
            "#6950a1",
            "#918597"
        ],
        "series": [
            {
                "type": "wordCloud",
                "shape": "diamond",
                "rotationRange": [
                    0,
                    0
                ],
                "rotationStep": 45,
                "girdSize": 20,
                "sizeRange": [
                    20,
                    100
                ],
                "data": [
                    {
                        "name": "image",
                        "value": 428,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(133,84,9)"
                            }
                        }
                    },
                    {
                        "name": "network",
                        "value": 293,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(113,145,61)"
                            }
                        }
                    },
                    {
                        "name": "learn",
                        "value": 273,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(59,150,31)"
                            }
                        }
                    },
                    {
                        "name": "model",
                        "value": 236,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(25,148,6)"
                            }
                        }
                    },
                    {
                        "name": "method",
                        "value": 223,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(50,3,66)"
                            }
                        }
                    }
                ],
                "drawOutOfBound": false,
                "textStyle": {
                    "emphasis": {}
                }
            }
        ],
        "legend": [
            {
                "data": [],
                "selected": {},
                "show": true,
                "padding": 5,
                "itemGap": 10,
                "itemWidth": 25,
                "itemHeight": 14
            }
        ],
        "tooltip": {
            "show": true,
            "trigger": "item",
            "triggerOn": "mousemove|click",
            "axisPointer": {
                "type": "line"
            },
            "showContent": true,
            "alwaysShowContent": false,
            "showDelay": 0,
            "hideDelay": 100,
            "textStyle": {
                "fontSize": 14
            },
            "borderWidth": 0,
            "padding": 5
        },
        "title": [
            {
                "text": "u8bcdu4e91u56fe",
                "padding": 5,
                "itemGap": 10
            }
        ]
    };
    chart_989fe02908e64618a085e023db0f2239.setOption(option_989fe02908e64618a085e023db0f2239);
</script>

</html>

(9)words.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>查询</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/jquery-3.1.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/echarts-cloud.js"></script>
    <script src="js/echarts.min.js"></script>
    <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>
    <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts-wordcloud.min.js"></script>
</head>
<body>
<style>
    table{
        table-layout:fixed;
        100%;
    }
    td {
        white-space:nowrap;/*文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。*/
        overflow:hidden;/*隐藏多余的内容*/
        -moz-text-overflow: ellipsis; /* for Firefox,mozilla */
    }
    a:link{
        color:blue;
    }
    a:visited{
        color:blue;
    }
    a:hover{
        color:red;
    }
    a{
        font-size:22px;
        font-family:"楷体";
        font-weight:2px;
    }
    h1{
        color:red;
        font-size:44px;
    }
</style>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-3">
            <div class="list-group">
                <a href="WordServlet?method=show"><h2 align="center">浏览论文基本信息</h2></a>
                <a href="words.jsp"><h2 align="center">浏览热词基本信息</h2></a>
            </div>
        </div>
        <div class="col-md-9">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">热词分析 &nbsp;<i class="fa fa-book pull-right" aria-hidden="true"></i></h3>
                </div>
                <div class="panel-body">
                    <div class="panel-body">
                        <form action="WordServlet?method=show1" method="post">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="您要搜索的TOP" name="num"/>
                            </div><!-- /input-group -->
                            <span class="input-group-btn">
                <button class="btn btn-primary" type="submit" >搜索</button>
              </span>
                        </form>
                    </div>
              </span>
                </div>
                <div id="cy" style=" 800px; height: 600px;">
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</body>
<script>
    var chart_5873da6363c341599e67e661d39df3e9 = echarts.init(
        document.getElementById('cy'), 'white', {renderer: 'canvas'});
    var option_5873da6363c341599e67e661d39df3e9 = {
        "animation": true,
        "animationThreshold": 2000,
        "animationDuration": 1000,
        "animationEasing": "cubicOut",
        "animationDelay": 0,
        "animationDurationUpdate": 300,
        "animationEasingUpdate": "cubicOut",
        "animationDelayUpdate": 0,
        "color": [
            "#c23531",
            "#2f4554",
            "#61a0a8",
            "#d48265",
            "#749f83",
            "#ca8622",
            "#bda29a",
            "#6e7074",
            "#546570",
            "#c4ccd3",
            "#f05b72",
            "#ef5b9c",
            "#f47920",
            "#905a3d",
            "#fab27b",
            "#2a5caa",
            "#444693",
            "#726930",
            "#b2d235",
            "#6d8346",
            "#ac6767",
            "#1d953f",
            "#6950a1",
            "#918597"
        ],
        "series": [
            {
                "type": "wordCloud",
                "shape": "diamond",
                "rotationRange": [
                    0,
                    0
                ],
                "rotationStep": 45,
                "girdSize": 20,
                "sizeRange": [
                    20,
                    100
                ],
                "data": [
                    {
                        "name": "image",
                        "value": 428,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(57,16,116)"
                            }
                        }
                    },
                    {
                        "name": "network",
                        "value": 293,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(29,58,16)"
                            }
                        }
                    },
                    {
                        "name": "learn",
                        "value": 273,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(0,129,23)"
                            }
                        }
                    },
                    {
                        "name": "model",
                        "value": 236,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(105,125,66)"
                            }
                        }
                    },
                    {
                        "name": "method",
                        "value": 223,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(97,134,71)"
                            }
                        }
                    },
                    {
                        "name": "ject",
                        "value": 169,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(35,109,54)"
                            }
                        }
                    },
                    {
                        "name": "use",
                        "value": 162,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(42,114,135)"
                            }
                        }
                    },
                    {
                        "name": "data",
                        "value": 161,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(46,60,69)"
                            }
                        }
                    },
                    {
                        "name": "propose",
                        "value": 160,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(71,123,105)"
                            }
                        }
                    },
                    {
                        "name": "base",
                        "value": 144,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(74,130,121)"
                            }
                        }
                    },
                    {
                        "name": "task",
                        "value": 143,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(156,64,23)"
                            }
                        }
                    },
                    {
                        "name": "video",
                        "value": 140,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(108,2,56)"
                            }
                        }
                    },
                    {
                        "name": "approach",
                        "value": 138,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(117,75,148)"
                            }
                        }
                    },
                    {
                        "name": "deep",
                        "value": 138,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(20,40,30)"
                            }
                        }
                    },
                    {
                        "name": "action",
                        "value": 124,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(138,106,121)"
                            }
                        }
                    },
                    {
                        "name": "attention",
                        "value": 121,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(38,92,140)"
                            }
                        }
                    },
                    {
                        "name": "scene",
                        "value": 117,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(56,152,108)"
                            }
                        }
                    },
                    {
                        "name": "university",
                        "value": 115,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(32,48,3)"
                            }
                        }
                    },
                    {
                        "name": "training",
                        "value": 113,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(2,34,92)"
                            }
                        }
                    },
                    {
                        "name": "feature",
                        "value": 111,
                        "textStyle": {
                            "normal": {
                                "color": "rgb(80,70,132)"
                            }
                        }
                    }
                ],
                "drawOutOfBound": false,
                "textStyle": {
                    "emphasis": {}
                }
            }
        ],
        "legend": [
            {
                "data": [],
                "selected": {},
                "show": true,
                "padding": 5,
                "itemGap": 10,
                "itemWidth": 25,
                "itemHeight": 14
            }
        ],
        "tooltip": {
            "show": true,
            "trigger": "item",
            "triggerOn": "mousemove|click",
            "axisPointer": {
                "type": "line"
            },
            "showContent": true,
            "alwaysShowContent": false,
            "showDelay": 0,
            "hideDelay": 100,
            "textStyle": {
                "fontSize": 14
            },
            "borderWidth": 0,
            "padding": 5
        },
        "title": [
            {
                "text": "u8bcdu4e91u56fe",
                "padding": 5,
                "itemGap": 10
            }
        ]
    };
    chart_5873da6363c341599e67e661d39df3e9.setOption(option_5873da6363c341599e67e661d39df3e9);
</script>
</html>
原文地址:https://www.cnblogs.com/Clark-Shao/p/14902140.html