顶会热词统计4

lunwenBean.java

package com.bean;

public class lunwenBean {
    private String title;
    private String as;
    private String zuozhe;
    private String link;
    private String keywords;
    private String time;
    public lunwenBean(String title, String link, String zuozhe, String as,String keywords,String time) {
        super();
        this.title = title;
        this.link = link;
        this.zuozhe = zuozhe;
        this.as = as;
        this.keywords =keywords;
        this.time = time;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getAs() {
        return as;
    }

    public void setAs(String as) {
        this.as = as;
    }

    public String getZuozhe() {
        return zuozhe;
    }

    public void setZuozhe(String zuozhe) {
        this.zuozhe = zuozhe;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }
}

 

Index.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>论文查询</title>
   <link rel="stylesheet" href="css/style.css">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<style>
    input[type=text] {
        width: 100%;
        padding: 12px 20px;
        margin: 8px 0;
        display: inline-block;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-sizing: border-box;
    }

    input[type=submit] {
        width: 100%;
        background-color: #4CAF50;
        color: white;
        padding: 14px 20px;
        margin: 8px 0;
        border: none;
        border-radius: 4px;
        cursor: pointer;
    }

    input[type=submit]:hover {
        background-color: #45a049;
    }

    input[type=button], input[type=reset] {
        background-color: #66BBFF;
        border: none;
        color: white;
        padding: 16px 32px;
        text-decoration: none;
        margin: 4px 2px;
        cursor: pointer;
    }

    #feny input[type=button] {
        background-color: #DDDDDD;
        border: none;
        color: black;
        padding: 16px 16px;
        text-decoration: none;
        margin: 4px 4px;
        cursor: pointer;
        width: 20px;
        height: 20px;

    }
</style>


<body>
  <h1 align="center" style="font-family: 微软雅黑;font-size:25px;">论文模糊查询</h1>
  <form action="servlet?method=findlunwen" method="post" id="biaodan">
    <div align="center" id="firdiv">
        <table align="center">
            <tr>
                <td><input type="text" id="as" name="as" placeholder="请输入摘要"></td>
                <td><input type="text" id="title" name="title" placeholder="请输入关键词"></td>
                <td><input type="text" id="zuozhe" name="zuozhe" placeholder="请输入作者"></td>
                <td>
                    <form method="post" id="tjdiv">
                        <div align="center"><input type="button" value="查询" onclick="sendAjax()" class="findbtn"></div>
                    </form>
                </td>
                <td>
                    <div align="center">
                        <input type="button" onclick="x()" value="词云图"></input>
                    </div>
                </td>
            </tr>
        </table>
        <script>
            function x() {
                window.open('view.jsp');
            }
        </script>
        <div align="center" id="reslunwendiv" class="subbox" style="margin-top: 50px">
            <table id="restable">
            </table>
        </div>
    </div>
  </form>
</body>
<script type="text/javascript">
    var findnummm = 0;
    var resnum = 0;
    var alldata;

    function sendAjax() {
        var url = "servlet?method=findlunwen&randnum=" + Math.random();
        $.ajax({
            type: "get",
            url: url,
            data: $('#biaodan').serialize(),
            dataType: "json",
            success: function (result) {
                //alert("success--result:"+result[0].title);
                alldata = result;
                reslist(result);
                if (findnummm == 0) {
                    addresfinddiv();
                    findnummm = 1;
                } else changeresnum();
            },
            error: function () {
                alert("error");
            }

        });
    }

    function reslist(data) {
        var tab = document.getElementById("restable");
        var str = "<tr>" +
            "<td width='35%' style='background: #66BBFF;font-family:微软雅黑;'>标题</td>" +
            "<td width='35%' style='background: #66BBFF;font-family:微软雅黑;'>作者</td>" +
            "<td width='15%' style='background: #66BBFF;font-family:微软雅黑;'>时间</td>" +
            "<td width='15%' style='background: #66BBFF;font-family:微软雅黑;'>链接</td>" +
            "</tr>";
        for (i in data) {
            str = str + "<tr><td>" + data[i].title + "</td><td>" + data[i].zuozhe + "</td><td>" + data[i].time + "</td><td><a target='_blank' href='" + data[i].link + "'>" + "文章链接" + "</a></td></tr>";
            resnum = resnum + 1;
        }
        tab.innerHTML = str;
    }

    function addresfinddiv() {
        var formdiv = document.getElementById("tjdiv");
        var str = "<h2 align='center' id='totalnumh'>一共" + resnum + "条</h2>"
        var div = document.createElement("div");
        div.id = "changeresdiv";
        div.innerHTML = str;
        formdiv.appendChild(div);
        resnum = 0;
    }

</script>
</html>

 

 

 

 

posted @ 2021-06-14 16:10  第厘  阅读(40)  评论(0编辑  收藏  举报