论文查询系统(二)
index.jsp
<%-- Created by IntelliJ IDEA. User: 榕宝 Date: 2022/5/14 Time: 15:42 To change this template use File | Settings | File Templates. --%> <%@ page import="jdk.nashorn.internal.ir.FunctionNode" %><%@ page import="Bean.bean" %> <%@ page import="java.util.List" %> <%@ page import="com.sun.org.apache.xpath.internal.objects.XNumber" %> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>论文查询系统</title> <script th:src="@{/layuimini/js/lay-module/echarts/echarts.js}"></script> <script th:src="@{/layuimini/js/lay-module/echarts/wordcloud.js}"></script> <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" /> <script src="https://www.layuicdn.com/layui/layui.js"></script> <style> .success { background-color: rgba(199, 199, 199, 0.94); } #container1 { box-shadow: 5px 5px 5px 5px #b6b6b6; border-radius: 20px; } #container2 { box-shadow: 5px 5px 5px 5px #b6b6b6; border-radius: 20px; } /*整个tab层居中,宽度为600px*/ #tabDiv { width: 600px; margin: 1em auto; padding-bottom: 10px; border-right: #ffffff 1px solid; border-top: #ffffff 1px solid; border-left: #ffffff 1px solid; border-bottom: #ffffff 1px solid; background-color:#fffef9 ; } /*tab头的样式*/ #tabsHead { height: 226px; background-color:#9bc1d2 ; } /*已选tab头(超链接)的样式*/ .curtab { padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; border-right: #294224 1px solid; font-weight: bold; float: left; cursor: pointer; } /*未选tab头(超链接)的样式*/ .tabs { border-right: #ffffff 1px solid; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; font-weight: normal; float: left; cursor: pointer; } a { color: #ffffff; text-decoration:none; font-size:15px;/*设置字体大小*/ font-weight:3px;/*调整字体粗细*/ } a:hover { color: #d0f5a6; font-size: 15px; } </style> <script type="text/jscript"> //显示tab(tabHeadId:tab头中当前的超链接;tabContentId要显示的层ID) function showTab(tabHeadId,tabContentId) { //tab层 var tabDiv = document.getElementById("tabDiv"); //将tab层中所有的内容层设为不可见 //遍历tab层下的所有子节点 var taContents = tabDiv.childNodes; for(i=0; i<taContents.length; i++) { //将所有内容层都设为不可见 if(taContents[i].id!=null && taContents[i].id != 'tabsHead') { taContents[i].style.display = 'none'; } } //将要显示的层设为可见 document.getElementById(tabContentId).style.display = 'block'; //遍历tab头中所有的超链接 var tabHeads = document.getElementById('tabsHead').getElementsByTagName('a'); for(i=0; i<tabHeads.length; i++) { //将超链接的样式设为未选的tab头样式 tabHeads[i].className='tabs'; } //将当前超链接的样式设为已选tab头样式 document.getElementById(tabHeadId).className='curtab'; document.getElementById(tabHeadId).blur(); } </script> </head> <div id="tabDiv" style="width:100%;height:100%;margin: auto; "> <div id="tabsHead" style="float:left;width:12%;height:1000px;text-align:center; background-color: #232323 "> <p> </p> <p> </p> <h3 style="color:#ffffff">论文查询系统</h3> <p> </p><br> <a id="tabs1" class="curtab" href="javascript:showTab('tabs1','tabContent1')">单项查询</a><br> <p> </p> <a id="tabs2" class="tabs" href="javascript:showTab('tabs2','tabContent2')">多项查询</a> <br> <p> </p> <a id="tabs3" class="tabs" href="javascript:showTab('tabs3','tabContent3')">添加论文</a><br> <p> </p> <a id="tabs4" class="tabs" href="javascript:showTab('tabs4','tabContent4')">热点词云</a><br> </div> <div id="tabContent1" class="main" style="width:1300px;height:100%;float:left; position:relative;margin: 30px auto"> <p style="text-align: center; font-size: 30px"> </p> <form class="layui-form"action="table1.jsp" method="post" target="hideIframe1" > <div class="layui-form-item"> <div class="layui-inline"> <label class="layui-form-label"> 标题: </label> <div class="layui-input-inline"> <input type="text" name="title" id="title" class="layui-input"> </div> </div> <div class="layui-inline"> <div class="layui-input-inline"> <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">查询</button> </div> </div> </div> </form> <div class="container3"> <iframe id="myIframe1" name="hideIframe1" style="" src="table1.jsp" frameborder="0" width="100%" height="850px"></iframe> </div> </div> <div id="tabContent2" class="main" style="width:1300px;height:100%;float:left; display: none;position:relative;margin: 30px auto"> <p style="text-align: center; font-size: 30px"> </p> <form class="layui-form"action="table2.jsp" method="post" target="hideIframe2" > <div class="layui-form-item"> <div class="layui-inline"> <label class="layui-form-label"> 标题: </label> <div class="layui-input-inline"> <input type="text" name="title" class="layui-input"> </div> </div> <div class="layui-inline"> <label class="layui-form-label"> 作者: </label> <div class="layui-input-inline"> <input type="text" name="author" class="layui-input"> </div> </div> <div class="layui-inline"> <div class="layui-input-inline"> <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">查询</button> </div> </div> </div> </form> <div class="container3"> <iframe id="myIframe2" name="hideIframe2" style="" src="table2.jsp" frameborder="0" width="100%" height="850px"></iframe> </div> </div> <div id="tabContent3" class="main" style="width:1300px;height:100%;float:left; position:relative;display: none;margin: 30px auto"> <p style="text-align: center; font-size: 30px"> </p> <p> </p> <p> </p> <form action="add`.jsp"> <table class="layui-table"style="table-layout: fixed;word-wrap:break-word;" > <tr> <td>标题</td> <td><input type="text" name="title" class="layui-input"></td> </tr> <tr> <td>作者</td> <td><input type=" text" name="author" class="layui-input"></td> </tr> <tr> <td>日期</td> <td><input type="text" name="date" class="layui-input"></td> </tr> <tr> <td>链接</td> <td><input type="text"name="pdf" class="layui-input"></td></tr> <tr> <td style="width: 150px"><button type="submit" class="layui-btn">添加</button></td> <td><button type="reset" class="layui-btn" style="background-color: #dc143c" >重置</button></td> </tr> </table> </form> </div> </html>
table1.jsp
<%-- Created by IntelliJ IDEA. User: 榕宝 Date: 2022/5/14 Time: 16:18 To change this template use File | Settings | File Templates. --%> <%@ page import="Bean.bean" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="java.util.List" %> <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>Title</title> <script th:src="@{/layuimini/js/lay-module/echarts/echarts.js}"></script> <script th:src="@{/layuimini/js/lay-module/echarts/wordcloud.js}"></script> <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" /> <script src="https://www.layuicdn.com/layui/layui.js"></script> </head> <jsp:useBean id="util" class="Dao.dao"/> <% request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); String title=request.getParameter("title"); int a=0; %> <%if (title == null){%> <table class="layui-table" id="table1"> <thead> <tr> <td>序号</td> <td>标题</td> <td>作者</td> <td>日期</td> <td>操作</td> </tr> </thead> </table> <%}else{ List<bean> list = util.searchBytitle(title); %> <div class="container3" id="container3"> <table class="layui-table"style="table-layout: fixed;word-wrap:break-word;" > <thead> <tr> <td style="width: 100px">序号</td> <td>标题</td> <td>作者</td> <td style="width: 100px">日期</td> <td style="width: 300px">链接</td> <td style="width: 150px">操作</td> </tr> </thead> <tbody> <%for (bean b : list) { a++;%> <tr> <td style="width: 100px"><%=b.getId()%></td> <td><%=b.getTitle()%></td> <td><%=b.getAuthor()%></td> <td style="width: 100px"><%=b.getDate()%></td> <td style="width: 300px"><%=b.getPdf()%></td> <td style="width: 150px"><a href="update.jsp?id=<%=b.getId()%>"><button type="submit" class="layui-btn">修改</button></a> <a href="delete.jsp?id=<%=b.getId()%>"><button type="submit" class="layui-btn" style="background-color: #dc143c" >删除</button></a></td> </tr> <%} %> </tbody> </table> </div> <p>共<%=a%>条记录</p> <%}%> </html>
table2.jsp
<%-- Created by IntelliJ IDEA. User: 榕宝 Date: 2022/5/14 Time: 17:19 To change this template use File | Settings | File Templates. --%> <%@ page import="Bean.bean" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="java.util.List" %> <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>Title</title> <script th:src="@{/layuimini/js/lay-module/echarts/echarts.js}"></script> <script th:src="@{/layuimini/js/lay-module/echarts/wordcloud.js}"></script> <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" /> <script src="https://www.layuicdn.com/layui/layui.js"></script> </head> <jsp:useBean id="util" class="Dao.dao"/> <% request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); String title=request.getParameter("title"); String author=request.getParameter("author"); int a=0; %> <%if (title == null||author==null){%> <table class="layui-table" > <thead> <tr> <td>序号</td> <td>标题</td> <td>作者</td> <td>日期</td> <td>操作</td> </tr> </thead> </table> <%}else{ List<bean> list = util.search(author,title); %> <div class="container3" id="container3"> <table class="layui-table"style="table-layout: fixed;word-wrap:break-word;" > <thead> <tr> <td style="width: 100px">序号</td> <td>标题</td> <td>作者</td> <td style="width: 100px">日期</td> <td style="width: 300px">链接</td> <td style="width: 150px">操作</td> </tr> </thead> <tbody> <%for (bean b : list) { a++;%> <tr> <td style="width: 100px"><%=b.getId()%></td> <td><%=b.getTitle()%></td> <td><%=b.getAuthor()%></td> <td style="width: 100px"><%=b.getDate()%></td> <td style="width: 300px"><%=b.getPdf()%></td> <td style="width: 150px"><a href="update.jsp?id=<%=b.getId()%>"><button type="submit" class="layui-btn">修改</button></a> <a href="delete.jsp?id=<%=b.getId()%>"><button type="submit" class="layui-btn" style="background-color: #dc143c" >删除</button></a></td> </tr> <%} %> </tbody> </table> </div> <p>共<%=a%>条记录</p> <%}%> </html>
add`.jsp
<%-- Created by IntelliJ IDEA. User: 榕宝 Date: 2022/5/14 Time: 19:56 To change this template use File | Settings | File Templates. --%> <%@ page import="Dao.dao" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Title</title> </head> <body> <jsp:useBean id="util" class="Dao.dao"/> <% request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); String title=(request.getParameter("title")); String author=(request.getParameter("author")); String date=(request.getParameter("date")); String pdf=(request.getParameter("pdf")); if(dao.add(title,author,date,pdf)) {out.print("<script language='javaScript'> alert('添加成功');</script>"); response.setHeader("refresh", "0;url=shouye.jsp");} else{ out.print("<script language ='javaScript'> alert('添加失败');window.history.back(-1); </script>"); } %> </body> </html>